Exit Bidness
-
Okay. On my mu* I want to separate exits to 'outside' places from 'inside' places. For example I want a street listed separate from a apartment building in the @conformat of a room's look. Would it be better to have outside and inside exit parents or just to set an attribute on the exit and have a switch() or something in the @conformat?
-
@icanbeyourmuse
I am doing this with my @conformat on TheatreMUSH. Easiest way I found to do it was to do attributes with an if, and have a function that displays them separately. I have attributes on the exits: &grid (for directions) and &bldg (for going into buildings/locations), and the @conformat has two different listings to show things with those attrs.I have it set a register for all the exits that have each type, then run those exits through the method of exit display (I use a table for building entrances, and an iter for directions). I also have it set up so that it only gives that split if a room is IC. If the register is more than 1 character long (as it'll be DBREFs), then it displays; otherwise it doesn't. From there, if you're inside a building, the exits just need the &grid attr to display (I'm setting these as I build, so it's a bit easier than if you're converting).
I'll post the codebit below for the table version (which displays 2 per line, with no 'leads to' notes). Do note that it IS written for Penn, so I use custom registers pretty heavily (but it's simple enough to adjust). line() is my display line. (And yes, Im sure there's better ways to do it, my code is my code).
&fn`locations Room Parent <RP>=[setq(BLDG,)][iter([lexits(%L)],[if([hasattr(##,bldg)],[setq(BLDG,%q<BLDG> ##)])])][setq(BLDG,[squish(%q<BLDG>)])][if([gt([strlen(%q<BLDG>)],1)],%R[line([ansi(hb,Locations)])]%R[table([iter(%q<BLDG>,* [ansi(h,[name([itext(0)])])],%b,|)],35,78,|)]
If you use @firstexit to move exit order around, any use of @exitformat in a flat line-by-line iter will still work correctly. It comes out looking like this:
-
This might be more appropriate in the 'How-To' section, but.
My advice is to have an indoor and an outdoor parent, and then setup your @conformat with an if(strmatch(parent(<exit>), <parent you want>), <list parent>), and do this twice for your two different exit lists.
-
Awesome! I'll try these methods. I wasn't sure on which was est so I went with code, seemed better to error towards it being a code thing over a How To.
-
@icanbeyourmuse
If you end up needing some further help, feel free to PM me. I'm not doing anything today but coding for my game in between bouts of stomach bug. -
@Cobaltasaurus said:
This might be more appropriate in the 'How-To' section, but.
My advice is to have an indoor and an outdoor parent, and then setup your @conformat with an if(strmatch(parent(<exit>), <parent you want>), <list parent>), and do this twice for your two different exit lists.
You can have an Indoor Room Parent and an Outdoor Room Parent. You can then test the parents of the home() and loc() to discover that the exit goes inside->outside, outside->inside, or neither. Then the parent of your exits doesn't matter and as a benefit you can tell if a room is outside or inside for the purposes of weather, time, vehicles, etc.
-
@Sponge said:
@Cobaltasaurus said:
This might be more appropriate in the 'How-To' section, but.
My advice is to have an indoor and an outdoor parent, and then setup your @conformat with an if(strmatch(parent(<exit>), <parent you want>), <list parent>), and do this twice for your two different exit lists.
You can have an Indoor Room Parent and an Outdoor Room Parent. You can then test the parents of the home() and loc() to discover that the exit goes inside->outside, outside->inside, or neither. Then the parent of your exits doesn't matter and as a benefit you can tell if a room is outside or inside for the purposes of weather, time, vehicles, etc.
That's helpful, thanks.
-
I couldn't figure out the parent way to do it (I rarely work with parents save for parenting rooms to a main one) but I did get the attribute on the exit to work. What my base code for it looks like (not the full conformat):
[iter(lexits(here),[if(hasattr(##,_direction),name(##))])]
Feel free to suggest tweaks!
-
@icanbeyourmuse
Belated, but I did end up tweaking mine. I set it so that it checks all exits and, if they have the attr that denotes them as a 'building entrance' it strips them from the main list and displays them separately; only requires one attribute now, unlike my first version (I don't know WHY I didn't write it that way the first time, stupid brain).