|
CrazyKid Beginner
Joined: 28 Mar 2001 Posts: 27
|
Posted: Wed Feb 19, 2003 8:18 pm
Calculate *where* to speedwalk to? |
Would it be possible to have a script to lets say determine which of 5 or so places is closer (based on the number of moves over the map) and then move to the closest?
Thanks!
-Matt |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Wed Feb 19, 2003 8:29 pm |
Sure is:
#ALIAS goToClosest {#VAR rooms {%1};#VAR steps 99999;#VAR closest %item(@rooms, 1);#FORALL @rooms {#IF (%numitems(%pathexpand(%walk(%i))) < @steps) {#VAR steps {%numitems(%pathexpand(%walk(%i)))};#VAR closest {%i}}};#WALK @closest}
Just give a stringlist with the room numbers to the alias and it will pick the one that is closest. Example:
goToClosest 10|35|67|23
Kjata
Edit: Changed numitmes to numitems
Edited by - tondiening on 02/19/2003 13:35:30 |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Wed Feb 19, 2003 10:55 pm |
Heh, thanks Ton. I noticed the error after posting the reply but at that exact moment my ADSL decided to stop working. So I could only sit there watching the error and not being able to do anything about it.
Kjata |
|
|
|
|
|