mapfilter
Syntax: %mapfilter(SQLstring)
Sets or returns the current filter used for manipulating rooms via scripting commands. Normally, all rooms in the entire map are available for scripting. So, %numrooms() will return the total number of rooms on the map. By using %mapfilter, you can limit the rooms that are used in the scripting. Filter is an ADO database filter expression. This is like a normal arithmetic expression and is used to test various database table fields. For example, Name is the room name, Desc is the room description, ZoneID is the zone number, etc.
You cannot mix "and" and "or" statements in a single filter. To clear the current filter and return to using all rooms in scripts, use a null string for the filter.
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.