|
killunix Beginner
Joined: 18 Nov 2007 Posts: 28
|
Posted: Thu Nov 29, 2007 1:38 pm
%numrooms() questions! |
i need to traversing all the rooms in a zone to find a NPC and do something, i had read the zmud's help files, it tell me the %numrooms() function can retune the number of the rooms in the zone. infact it return the number of the rooms all the map,
how can i do?
thank you very much! |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Thu Nov 29, 2007 1:53 pm |
I think you misunderstood the documentation mines says
Quote: |
numrooms
Syntax: %numrooms()
Return the number of rooms in the current map filter. |
Now you can establish a %mapfilter i.e. a SQL query string to the mapper to DB to only reference a particular zone. But you have to set it up. |
|
_________________ Asati di tempari! |
|
|
|
killunix Beginner
Joined: 18 Nov 2007 Posts: 28
|
Posted: Thu Nov 29, 2007 2:43 pm |
thank you very much!
very good!
but another question:
i use the #loop command to search NPC, when i found it, how can i end the loop and do other commands? |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Thu Nov 29, 2007 3:17 pm |
The #abort command is used to break loops.
|
|
|
|
killunix Beginner
Joined: 18 Nov 2007 Posts: 28
|
Posted: Thu Nov 29, 2007 3:29 pm |
i used the code:
#var test 1
#CALL %mapfilter(%concat("ZoneID = ",%zonenum(testzone)))
#LOOP %numrooms {
#show %roomnum( %mapvnum( %i))
#math test (@test+1)
#if (@test>5) {#abort}
}
#CALL %mapfilter("")
i need echo 5 rooms int the zone,but it can't work, what's the problem? thanks |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Thu Nov 29, 2007 3:56 pm |
Because the #abort is only aborting the current block, the #if command. You need to use #abort 1 to abort the entire script (which will stop any command after the #loop being run as well - you'll need to find a way around that, like adding the commands to a one-time alarm that's created before the loop is run).
But why be hard on yourself?
#loop 5 {#show %roomnum( %mapvnum( %i))} |
|
|
|
killunix Beginner
Joined: 18 Nov 2007 Posts: 28
|
Posted: Thu Nov 29, 2007 4:33 pm |
dir fang,
are you chinese? the #show command just for test, i will use the #walk command go to the target room |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Fri Nov 30, 2007 3:34 am |
Nope, just light-fingered when it comes to foreign phrases :)
One option could be to use the #additem command to add the room numbers that the loop returns to a string list. Then you can walk to each of them at your leisure by returning an item from the list with %item or %pop. |
|
|
|
|
|