About Us
Products
Purchase
Downloads
Support
Forums
Contact Us
Site
 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
rozdwojeniejazni
Wanderer


Joined: 13 Aug 2011
Posts: 74

PostPosted: 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?
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4735
Location: Pensacola, FL, USA

PostPosted: Thu Apr 19, 2012 3:08 pm   
 
#FO $roomexit() {
$this=%reversedir(%reversedir(%i))
#PRINT {$this - %roomlink(, $this)}
}
_________________
Discord: Shalimarwildcat
Reply with quote
rozdwojeniejazni
Wanderer


Joined: 13 Aug 2011
Posts: 74

PostPosted: Thu Apr 19, 2012 7:49 pm   
 
Nope, double reverse doesn't work in this case (i.e. converting single speedwalk char to direction).
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: 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
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