|
horks Apprentice
Joined: 20 Jul 2001 Posts: 127 Location: USA
|
Posted: Sat May 11, 2002 6:45 am
Expanding dirs |
the mud I play on, gives me the room exits in this format:
Room name (n,e,nw,s,enter)
The room exits are randomly placed (even if i re-enter the room, the exits might be in a different order)
what I want to do, is expand the names. where e=east w=west etc. anyone know a simple way to do this? |
|
|
|
Sildaren Wanderer
Joined: 19 Jul 2001 Posts: 59 Location: Germany
|
Posted: Sat May 11, 2002 12:23 pm |
One problem is to know which lines contain the exits.
Without a good sample of mudoutput I can only hope that everything inside parenthesis always is exit information.
Now you can use a db variable to store the replacement info:
#ADDKEY alldirs {n=north|ne=northeast|e=east|se=southeast|s=south|sw=southwest|w=west|nw=northwest|u=up|d=down}
and a #SUBstitute trigger to replace the exits:
#TRIG {~((*)~)} {newdirs="(";#FORALL %replace("%1",",","|") {#VAR newdirs %concat(@newdirs,%if(%iskey(@alldirs,%i),%db(@alldirs,%i),%i),",")};#VAR newdirs %concat(%leftback(@newdirs,1),")");#SUB @newdirs}
now
#SH Room name (n,e,nw,s,enter)
gets converted to
Room name (north,east,northwest,south,enter)
Seems to work, but I haven't tested it extensively. |
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|