Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
horks
Apprentice


Joined: 20 Jul 2001
Posts: 127
Location: USA

PostPosted: 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?
Reply with quote
Sildaren
Wanderer


Joined: 19 Jul 2001
Posts: 59
Location: Germany

PostPosted: 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.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net