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
Stephen2_Aus
Newbie


Joined: 05 Nov 2007
Posts: 2

PostPosted: Mon Mar 14, 2011 12:49 am   

[map script] I feel like this must be "built in"
 
I wrote this script to walk me from anywhere to the zone specified:

Code:
#CALL %mapfilter(%concat("ZoneID = ", %zonenum(%-1)))

$numLeastSteps = 1000
$numSteps = 0
$roomFound = -1

#LOOP %numrooms {
  $numSteps = %numitems(%pathexpand(%walk(%mapvnum(%i))))
 
  #IF ($numSteps > 0) {   
    #IF ($numSteps < $numLeastSteps) {$numLeastSteps = $numSteps;$roomFound = %mapvnum(%i)}
  }
}

#IF ($roomFound <> -1) {#WALK $roomfound} {#SHOW 0}

#CALL %mapfilter("")


It was kinda fun to write, but I feel it is probably built in... any comments?

Thanks.
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Mon Mar 14, 2011 3:27 am   
 
I'm not sure I understand how this is different from the built-in double-click speed walk feature that's built in to the CMUD mapper?
_________________
Asati di tempari!
Reply with quote
Stephen2_Aus
Newbie


Joined: 05 Nov 2007
Posts: 2

PostPosted: Mon Mar 14, 2011 4:07 am   
 
It's different in that I can just type "gotoZone <zoneName>" and walk there by the quickest route.

Rather than: use mouse, click zone drop down list, find closest room in zone, double click

Saves a HEAP of time, which in a PK situation is vital.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Mon Mar 14, 2011 12:00 pm   
 
No, there is no built-in method to reach the closest room in a zone. Nor is there a built-in method to identify the closest room in the zone. You would have to use your own code to do either, as you have.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Mon Mar 14, 2011 8:36 pm   
 
I wrote a script to do this myself. Instead of looking for the shortest path, I just queried the map to find the lowest room ID number in a zone. I figured that the lowest room ID was the first room in the zone that I mapped, so it was likely to be the entrance room for the zone.

I agree that a built-in feature like this could be useful and will consider it for the future (not using the room ID but doing it right like you suggested based upon the existing speedwalk algorithm).
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