|
dazed-n-confused999 Wanderer
Joined: 03 Aug 2004 Posts: 79
|
Posted: 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 |
|
|
|
Daern Sorcerer
Joined: 15 Apr 2011 Posts: 809
|
Posted: 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
|
|
|
|
|
|
|
|
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
|
|