|
Snedge Newbie
Joined: 29 Jan 2003 Posts: 1 Location: United Kingdom
|
Posted: Wed Jan 29, 2003 8:21 pm
%numrooms() doesn't work as advertised? |
Just a quick question: According to the help files the numrooms function is supposed to return the number of the rooms in the current zone. However, it returns the total number of room in the map when I use it.
What am I missing? Someone save me from my own ignorance please. Oh, I'm using v6.40 |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Wed Jan 29, 2003 9:27 pm |
The help file is incorrect. Since zMUD now uses a "zoneless" database system to store the map, there really is no way for %numrooms to return the amount of rooms in the current zone unless you put a filter on the map.
Kjata |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Wed Jan 29, 2003 11:07 pm |
Filtering of the map can be done using the %mapfilter function. It never got into the help. When it does get in there this will be sort of what the text of the help page says.
mapfilter
Syntax: %mapfilter([SQLstring])
Sets or returns filter string for all map functions.
Example:
#CALL %mapfilter(%concat("ZoneID = ",%zonenum()))
#LOOP %numrooms {#SHOW %roomname(%mapvnum(%i))}
#CALL %mapfilter("")
The firstline sets the filter. Any database field can be filtered, and simple AND and OR combinations can be added (although AND and OR cannot be mixed in the same filter). Here, the current zone is fetched via the %zonenum function and appended to the "Zone ID = " string. Now, the second statement only performs the loop with the rooms that match the filter. The last line clears the filter so that all rooms are accessible again.
#ECHO %mapfilter
Displays the currently set filter string. |
|
|
|
|
|