 |
rozdwojeniejazni Wanderer
Joined: 13 Aug 2011 Posts: 74
|
Posted: Thu Apr 19, 2012 12:33 pm
Speedwalk character to regular direction |
Problem: I need to obtain roomnums, which I can go to from current room. Easily i created this code:
Code: |
#FO %roomexit() {
#sh %i - %roomlink(,%i)
} |
But it doesn't work, because roomexit() returns something like "w|k|e|l" and roomlink() needs dirs like w|se|e|sw.
So how do I convert it? |
|
|
 |
shalimar GURU

Joined: 04 Aug 2002 Posts: 4734 Location: Pensacola, FL, USA
|
Posted: Thu Apr 19, 2012 3:08 pm |
#FO $roomexit() {
$this=%reversedir(%reversedir(%i))
#PRINT {$this - %roomlink(, $this)}
} |
|
_________________ Discord: Shalimarwildcat |
|
|
 |
rozdwojeniejazni Wanderer
Joined: 13 Aug 2011 Posts: 74
|
Posted: Thu Apr 19, 2012 7:49 pm |
Nope, double reverse doesn't work in this case (i.e. converting single speedwalk char to direction).
|
|
|
 |
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Fri Apr 20, 2012 1:29 pm |
The way to do this is to either %replace() the single-letter directions with the correct two-letter direction, or use #SWITCH to essentially do the same thing. There is no easy conversion from single-letter path direction to proper direction name or abbreviation
|
|
|
 |
|
|