|
Stephen2_Aus Newbie
Joined: 05 Nov 2007 Posts: 2
|
Posted: 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. |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: 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! |
|
|
|
Stephen2_Aus Newbie
Joined: 05 Nov 2007 Posts: 2
|
Posted: 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. |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: 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.
|
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: 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). |
|
|
|
|
|