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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Articval
Novice


Joined: 01 Jun 2005
Posts: 47

PostPosted: Tue Mar 24, 2009 2:04 pm   

Directions such as sw, ne, not being "translated"
 
Hi, im using next trigger to track my possition:

#forall %pathexpand(%walk(2450)) {%i}

But then I use this, directions such as "i", "l", wont be translated into sw, se, or the direction which corresponds.

Is that intended to be that way?

Im going to solve it next way, but posted anyway in case u think this souldnt work that way:

#forall %pathexpand(%walk(2450)) {
#if %i=i {se}
#if %i=l {ne}
...
#if (%i=i OR %i=l OR ...) {} {%i}
}
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Tue Mar 24, 2009 2:20 pm   
 
Yes, that's the way %pathexpand works. For my own use, I have created a function @pathtodirlist() which expands a path to a stringlist of directions with the diagonals interpreted, and a varfunc @pathtodir() which returns a path as a comma separated set of directions:
Code:
<func name="pathtodirlist" id="198">
  <value>#local $newlist
#forall %1 {
  #switch (%i)
    ("l") {$newlist = %additem("se", $newlist)}
    ("j") {$newlist = %additem("ne", $newlist)}
    ("k") {$newlist = %additem("sw", $newlist)}
    ("h") {$newlist = %additem("nw", $newlist)}
    {$newlist = %additem(%i, $newlist)}
}
#return $newlist</value>
</func>

Code:
<var name="pathtodir" id="191">%expandlist(@pathtodirlist(%pathexpand(%1)),",")</var>
Reply with quote
Articval
Novice


Joined: 01 Jun 2005
Posts: 47

PostPosted: Tue Mar 24, 2009 3:20 pm   
 
Im not familiar yet with that kind of coding but i understand u do something similar to what i proposed.
Thx for the answer Very Happy
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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