Zone

From Wherigo Foundation Wiki
Jump to: navigation, search

An instance of the Zone object represents a particular zone.


Properties

Active Boolean When true, the engine processes events for this zone and zone visibility is controlled by the Visible property. When false, the engine does not fire events for this zone and the zone is not visible.
ClosestPoint ZonePoint Point with the shortest distance to player.
DistanceRange Distance The width of the distance band around the zone, which is used to trigger the OnDistant event. A value of -1 is magic, in that it causes the OnDistant event to fire on cartridge startup.
InRangeName String Name of zone if it is in range.
OutOfRangeName String Name of zone if it is out of range.
Points Table of ZonePoint Holds points for the boundary of the zone.
ProximityRange Distance The width of the proximity band around the zone, which is used to trigger the OnProximity event.
ShowObjects String Could be "OnEnter", "OnProximity", "Never" or "Always".
State String Indicates the player's relationship to this zone. As the player moves toward and into the zone, takes on the values "NotInRange", "Distant", "Proximity", "Inside". As the player moves out of and away from the zone, takes on the same values in reverse order. It is not clear how "NotInRange" and "Distant" behave when the distance setting is -1. Not updated for inactive zones, but should take on the correct value as soon as the zone is activated.
Visible Boolean When true and the zone is active, the zone is visible in the location list. When false, or when the zone is inactive, the zone does not appear in the location list. As of 03/19/2008, there are still compatibility issues with regard to the interaction of Visible and DistanceRange. Colorado and PPC have different behaviors with regard to showing the zone. Colorado shows the zone only when Active, Visible and the player is within distance range of the zone. PPC shows the zone when Active and Visible, regardless of player proximity.


Events

Events are fired only when the Active property is true.

OnDistant Fires when the player enters the distance range band around the zone. This fires both when the player enters the band from the outside and from the inside. In addition, if distance range is -1, this fires when the cartridge starts.
OnEnter Fires when the player enters the zone itself.
OnNotInRange Fires when the player gets farther than zone's distance range.
OnExit Fires when the player leaves the zone itself.
OnProximity Fires when the player enters the proximity range band around the zone. This fires both when the player enters the band from the outside and from the inside.
OnSetActive Fires when the zone becomes active or inactive.


Methods

Contains(Zone self, ZObject obj) Returns boolean. Is true, when the zone contains the obj or, if obj is Player, if it is inside.


Constructor

Zone Wherigo.Zone(ZCartridge cartridge) Returns a new instance of object Zone. The only parameter is a instance of ZCartridge.
Zone Wherigo.Zone({parameters}) Parameter is a table with default entries. It is possible to set the following properties: Active, Cartridge, Commands, CommandsArray, DistanceRange, InRangeName, OutOfRangeName, Points, ProximityRange, ShowObjects. Additionally all parameters, which are valid for ZObject constructor.