Colorful exits?



  • Short and quick: say you want to differentiate between private gridspace exits (let's call them gray) and normal gridspaces (let's assume the exits are uncolored already).

    Joe's House <JH>
    Bob's House <BH>
    Restaurant <R>
    Supermarket <S>

    Without touching exit parents, and using JUST a builder bit, is there a way to color JUST the exits for Joe and Bob's houses gray, so they can be differentiated as private residences, but not change the exits for the restaurant or the supermarket? PennMUSH 1.8.5. @exitformat does not appear to be what I'm looking for, and simply plugging in ANSI doesn't work. Thank you!


  • Coder

    Exitformat is what you're looking for. While I don't know Penn, I will give you a Mux answer:

    iter( %0, ansi( if( strmatch( <something about loc( %i0 )>, <is private> ), xh, n ), name( %i0 )), , %r )

    However, again in Mux, rooms may not have permission to see if a room is or isn't on the main grid, so you may be forced to create your own "privileged" user-defined function.

    &ufunc.room_on_grid: cand( hastype( %0, ROOM ), <however you determine this> )

    Then your room parent's @exitformat can:
    iter( %0, ansi( if( room_on_grid( loc( %i0 )), n, xh ), name( %i0 )), , %r )

    n.b., most of this is from memory and may need tweaked.

    (The possible secret: For exits, loc( <exit> ) returns the dbref of the room at the other end. For the room at this end, which is sometimes needed, it's home( <exit> ).)



  • Thank you! I'll see what I can poke at with the buildbit, though it may be a job for actual staff.


  • Coder

    @kls,

    Oh yes, this is not a builderbit job. It could be that there's something in Penn that's stopping you from setting ansi on exits. Have you tried the following?

    @fo me=@name <exit>=ansi( xh, Exit Name );alias;alias;alias

    That might be in your purview.



  • @Thenomain said:

    @fo me=@name <exit>=ansi( xh, Exit Name );alias;alias;alias

    Already tried that. @Forcing doesn't work. Exits are set no_command visual prefixmatch.



  • Does the builder have all the appropriate flags enabled?



  • I am not sure, and will leave that to staff, because it's not really my purview to discuss: @Alzie, @Groth , @Shavalyoth ? (But thanks! I'm just a volunteer player, though, not staff, and don't want to overstep my bounds.)


  • Coder

    Names can't contain ansi code because they are names and having code in them would be terrible.

    @exitformat here=Exits: %r[iter(%0, name(%i0) <[ansi(default(%i0/COLOR,d),alias(%i0))]> - [name(loc(%i0))]%r,,)]

    and
    &color <exitref>=<whatever color>

    Is the way to do it, replace exitformat with whatever you feel like.

    You could also instead of color have some sort of type attribute and use a switch in the exitformat to pull out the predetermined colors. Worthwhile types to consider for this game could be Open, Closed, Controlled, Rack, Safe Place, Elysium etc


  • Coder

    Not seeking to resurrect this topic. But for those who come one day later, a new feature now exists in PennMUSH which allows this behavior more easily: help monikers

    You can lean on the moniker() function, or fall back on the default exit format, for this functionality.


Log in to reply
 

Looks like your connection to MU Soapbox was lost, please wait while we try to reconnect.