Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
CrazyKid
Beginner


Joined: 28 Mar 2001
Posts: 27

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


Joined: 10 Oct 2000
Posts: 4379
Location: USA

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


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: 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
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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