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
dazed-n-confused999
Wanderer


Joined: 03 Aug 2004
Posts: 79

PostPosted: Sat Dec 14, 2013 5:56 am   

pathexpand giving invalid map directions
 
this is the code i use to try to fetch my minion from across the map to me, it works fine as long as its a straight line. as soon as there is a turn i get: .2wk for instance or .3nl, Im not sure where the l and k come from as these are not valid map directions. anyone have any ideas? please help.
#var chesspath1 %pathfrom(@chessloc, @mylocnum)
#var chesspath2 %pathexpand(@chesspath1)
#FORALL @chesspath2 {chm @chessnum %i}
#say @chesspath1
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Sat Dec 14, 2013 5:49 pm   
 
They actually are valid map directions: h is northwest, j is northeast, k is southwest and l is southeast. This is done because if you had a path like ".2wsw", it wouldn't be able to tell if that's two west, one south, one west, or two west, one southwest. These directions are automatically converted when using commands like #walk, but if you want to work with paths at a low level then you'll need to do it yourself. Something like this should suffice:
Code:
#var chesspath1 %pathfrom(@chesslog, @mylocnum)
#var chesspath2 %pathexpand(@chesspath1)
#forall @chesspath2 {
  $direction = %i
  #switch ($direction)
    ("h") {$direction = "nw"}
    ("j") {$direction = "ne"}
    ("k") {$direction = "sw"}
    ("l") {$direction = "se"}
  chm @chessnum $direction
}
#say @chesspath1
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