Zones

Zones are the latest of several methods you can use in Magsbot to tell when someone is within a particular area (as of version 5.3 b12).

Prior to zones, these older methods were available:

But the latest and greatest method, in 5.3 b12, is a new collection of commands and functions for dealing with "zones" (the new word I'm using to describe a defined area¹).

Briefly, it works like this: first you define a zone using the SetZoneN, SetZoneS, etc. buttons. The ZoneInfo button lets you check the zones you've defined, and SetZoneActive turns the zone on or off.

Or, you can create a zone manually using the ZONE command:

ZONE $zonename @north @south @west @east @bottom @top

or use ZONE_  instead of ZONE to create the zone but not activate it. You can later activate (or deactivate) a zone using ZONEACTIVE $zonename @state  (where @state=0 or 1 to turn the zone off or on, respectively).

The arguments are in SDK coordinates. The @bottom and @top arguments are optional; if you leave them out then the zone includes the entire vertical area within the N,S,W,E boundaries. (If you specify bottom but not top, it assumes the top is 10m above bottom.)

Zones aren't automatically saved when you exit Magsbot either, but you can use the "save zone list" and "load zone list" buttons on the root . tab of the actions panel.

The great thing about zones is that you don't need to use the AVATARCHANGE event to test (although you can if you want, using @inzone[$zonename,@session]). Instead you can use the ZONEENTER and ZONEEXIT events. Within a ZONEENTER or ZONEEXIT event you can use @avsession, $avname and $atr[avatar_zone] to tell who is entering or exiting the zone.² This is a lot faster since you don't have all those hundreds of AVATARCHANGE messages going to the behavior table everytime someone moves or gestures; ZONEENTER or ZONEEXIT are only sent when an avatar actually passes a zone boundary.

To receive ZONEENTER and ZONEEXIT events, you should have Zone Checking turned on for the instances you want to receive them. Avatar Tracking also must be on. The default settings for Av Tracking and Zone Checking that will be used for newly-created instances are set in the Options menu, and you can turn them on or off for individual instances using the AVTRACKING_ and ZONECHECKING_ commands.

As of version 7.4.6, you can specify a zone's priority with ZONEPRIORITY $zonename @priority.  The @zonepriority[$zonename] function can be used to find a zone's priority.  The priority of a zone determines what happens when zones overlap; the zone with the higher priority will be treated as the zone that an avatar is in.

Zone-related commands

Zone-related functions
 
1 The AW SDK uses the word "zone" to refer to something completely unrelated, i.e. property, so don't confuse the two. Sorry but we're running out of words here!
2 Note that $atr[avatar_zone] is only available within a ZONEENTER or ZONEEXIT event. If you need to find an avatar's zone under other circumstances, then use the $avzone[@session] function instead, which works like the various avtracking functions, e.g. @avz[@session], etc.