Regions

From SphereWiki
Revision as of 13:59, 20 June 2009 by MrSugarCube (talk | contribs)
Jump to: navigation, search

Areas in the world, such as dungeons and cities are defined by regions. Accessing regions in scripts can be accomplished using the REGION reference from a character, item or map point object, or the AREA.region_id reference from the server object. The following tables detail the various properties of the region object in SphereServer:

References

References return pointers to other objects (e.g. the CHAR.n reference allows you to access the characters that are attached to the account). These can either be accessed by using <REFNAME> to return the UID (1 for object types that don't have UIDs) of the object or 0 if it doesn't exist, or by using <REFNAME.KEY> where KEY is a valid property/function/reference for the REFNAME object. Click on the name for more detailed information such as usage and examples.

Name Read/Write Description
REGION R For regions linked to a multi, gets the region that contains the multi region. Only valid for reading values.


Properties and Functions

Here is a list of all region properties and functions. If a function is marked as readable then it can return a value when used as <KEY>. Click on the name for more detailed information such as usage and examples. Properties from the region definition can also be accessed from the region object. If an attempt is made to execute (not read) a command that does not exist on the region or its definition, then the command will be called on all sectors that touch the region area.

Name Read/Write Description
ALLCLIENTS command W Executes command on all clients inside the region boundaries.
CLEARTAGS prefix W Removes all TAGs from the region that start with the given prefix.
CLIENTS R Gets the total number of clients that are inside the sectors that touch the region.
DEFNAME R Gets the region's defname.
EVENTS +/-regiontype_defname RW Gets a list of attached region events, or adds or removes a region event to or from the region.
ISEVENT.regiontype_defname R Returns 1 if the region has a specified region event attached.
MAP R Gets the map that the region exists on.
RECT R Gets the number of rectangles that this region is made from.
RECT.n R Gets the nth rectangle that this region is made from.
RESOURCES +/-regiontype_defname RW Gets a list of attached region events, or adds or removes a region event to or from the region.
TAGAT.index R Gets a TAG at the given zero-based index.
TAGAT.index.KEY R Gets the name of the TAG at the given zero-based index.
TAGAT.index.VAL R Gets the value of the TAG at the given zero-based index.
TAGCOUNT R Gets the number of TAGs stored on the region.
TAGLIST W Outputs a list of the region's TAGs.
TYPE R If the region is linked to a multi, returns the multi's TYPE property.
UID R Gets the region's unique ID in the world.


Triggers

Here is a list of all region triggers. Click on the trigger name for more detailed information such as arguments and examples.

Name Description
@CliPeriodic Fires multiple times approximately every 30 seconds, for each client in the region.
@Enter Fires when a character enters the region.
@Exit Fires when a character exits the region.
@RegPeriodic Fires once approximately every 30 seconds, as long as there is at least one client in the region.
@Step Fires whenever a character takes a step within the region.