Difference between revisions of "AREADEF"

From SphereWiki
Jump to: navigation, search
m (Added languagemenue)
 
(4 intermediate revisions by one other user not shown)
Line 1: Line 1:
 +
{{Languages|AREADEF}}
 +
 
__FORCETOC__
 
__FORCETOC__
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 [[Characters|character]], [[Items|item]] or [[Map Points|map point]] object, or the AREA.region_id reference from the [[Server|server]] object. The following tables detail the various properties of the region object in SphereServer:
+
Areas in the world, such as dungeons and cities are defined by regions. Regions are constructed from one or more "rectangles" on the map.
 +
 
 +
 
 +
The basic syntax for definining a region is as follows:
  
==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.
 
  
{| border="1" cellspacing="4" cellpadding="4"
+
<tt>
| '''Name''' || '''Read/Write''' || '''Description'''
+
[AREADEF ''defname'']<br />
|-
+
RECT=''left, top, right, bottom, map''<br />
| [[REGION]] || R || For regions linked to a multi, gets the region that contains the multi region. Only valid for reading values.
+
RECT=''left, top, right, bottom, map''<br />
|}
+
RECT=''left, top, right, bottom, map''<br />
 +
</tt>
  
  
==Properties and Functions==
+
==Properties==
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. If an attempt is made to execute (not read) a command that does not exist on the region, then the command will be called on all sectors that touch the region area.
+
Within the region definition the following properties are also available to customise the behaviour of the area.
  
 
{| border="1" cellspacing="4" cellpadding="4"
 
{| border="1" cellspacing="4" cellpadding="4"
 
| '''Name''' || '''Read/Write''' || '''Description'''
 
| '''Name''' || '''Read/Write''' || '''Description'''
|-
 
| [[ALLCLIENTS]] ''command'' || W || Executes ''command'' on all clients inside the region boundaries.
 
 
|-
 
|-
 
| [[ANNOUNCE]] || RW || Gets or sets whether or not there will be an announcement when someone enters or exits the region.
 
| [[ANNOUNCE]] || RW || Gets or sets whether or not there will be an announcement when someone enters or exits the region.
Line 24: Line 26:
 
| [[ARENA]] || RW || Gets or sets whether or not the region is considered to be an arena.
 
| [[ARENA]] || RW || Gets or sets whether or not the region is considered to be an arena.
 
|-
 
|-
| [[BUILDABLE]] || RW || Gets or sets whether or not players can place buildings in the region.
+
| [[BUILDABLE]] || RW || Gets or sets whether or not players can place buildings and ships in the region.
 
|-
 
|-
| [[CLEARTAGS]] ''prefix'' || W || Removes all TAGs from the region that start with the given prefix.
+
| [[EVENTS (Property)|EVENTS]] ''regiontype_defname'' || W || Adds a region event to the region.
|-
 
| [[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.
 
 
|-
 
|-
 
| [[FLAGS]] || RW || Gets or sets the region's attributes.
 
| [[FLAGS]] || RW || Gets or sets the region's attributes.
Line 40: Line 36:
 
| [[GROUP]] || RW || Gets or sets a group name for the region.
 
| [[GROUP]] || RW || Gets or sets a group name for the region.
 
|-
 
|-
| [[GUARDED]] || RW | Gets or sets whether or not guards can be called within the region.
+
| [[GUARDED]] || RW || Gets or sets whether or not guards can be called within the region.
|-
 
| [[ISEVENT]]''.regiontype_defname'' || R || Returns 1 if the region has a specified region event attached.
 
 
|-
 
|-
 
| [[MAGIC]] || RW || Gets or sets whether or not there is an anti-magic field in the region.
 
| [[MAGIC]] || RW || Gets or sets whether or not there is an anti-magic field in the region.
|-
 
| [[MAP]] || R || Gets the map that the region exists on.
 
 
|-
 
|-
 
| [[MARK]] || RW || Gets or sets whether or not casting the mark spell is allowed in the region.
 
| [[MARK]] || RW || Gets or sets whether or not casting the mark spell is allowed in the region.
Line 66: Line 58:
 
| [[RECALLOUT]] || RW || Gets or sets whether players can recall out of the region.
 
| [[RECALLOUT]] || RW || Gets or sets whether players can recall out of the region.
 
|-
 
|-
| [[RECT]] || R || Gets the number of rectangles that this region is made from.
+
| [[RECT]] ''left, top, right, bottom, map'' || W || Adds a rectangle to the region definition.
 
|-
 
|-
| [[RECT]]''.n'' || R || Gets the nth rectangle that this region is made from.
+
| [[RESOURCES]] ''regiontype_defname'' || W || Adds a region event to the region.
|-
 
| [[RESOURCES]] ''+/-regiontype_defname'' || RW || Gets a list of attached region events, or adds or removes a region event to or from the region.
 
 
|-
 
|-
 
| [[SAFE]] || RW || Gets or sets whether or not the region is a safe zone.
 
| [[SAFE]] || RW || Gets or sets whether or not the region is a safe zone.
 
|-
 
|-
 
| [[TAG]]''.name'' || RW || Gets or sets the value of a TAG.
 
| [[TAG]]''.name'' || RW || Gets or sets the value of a TAG.
|-
 
| [[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.
 
 
|-
 
|-
 
| [[UNDERGROUND]] || RW || Gets or sets whether or not the region is considered to be underground.
 
| [[UNDERGROUND]] || RW || Gets or sets whether or not the region is considered to be underground.
Line 94: Line 70:
  
  
==Triggers==
+
==Examples==
Here is a list of all region triggers. Click on the trigger name for more detailed information such as arguments and examples.
+
 
 +
<spherescript>
 +
//
 +
// The world region from the default script pack.
 +
//
 +
[AREADEF a_world]
 +
EVENTS=r_default,r_default_rock,r_default_water,r_default_tree,r_default_grass
 +
NAME=Felucca
 +
GROUP=ALLMAP
 +
P=1323,1624,55,0
 +
RECT=0,0,7168,4096,0
 +
</spherescript>
  
{| border="1" cellspacing="4" cellpadding="4"
+
<spherescript>
| '''Name''' || '''Description'''
+
//
|-
+
// Lord British's Castle from the default script pack.
| [[@CliPeriodic]] || Fires multiple times approximately every 30 seconds, for each client in the region.
+
//
|-
+
[AREADEF a_lord_britishs_castle_1]
| [[@Enter]] || Fires when a character enters the region.
+
EVENTS=r_default,r_default_rock,r_default_water,r_default_tree,r_default_grass
|-
+
NAME=Lord British's Castle
| [[@Exit]] || Fires when a character exits the region.
+
GROUP=Britain
|-
+
FLAGS=0648e
| [[@RegPeriodic]] || Fires once approximately every 30 seconds, as long as there is at least one client in the region.
+
P=1392,1625,30,0
|-
+
RECT=1294,1679,1411,1697,0
| [[@Step]] || Fires whenever a character takes a step within the region.
+
RECT=1295,1559,1313,1577,0
|}
+
RECT=1392,1559,1410,1577,0
 +
RECT=1302,1577,1410,1680,0
 +
RECT=1313,1563,1392,1577,0
 +
EVENTS=r_brit_castle
 +
TAG.GUARDOWNER=Lord British's Personal
 +
</spherescript>
  
 
[[Category: Reference Compendium]]
 
[[Category: Reference Compendium]]
[[Category: Objects]]
+
[[Category: Definitions]]

Latest revision as of 21:35, 26 November 2010

Help
Available languages


Areas in the world, such as dungeons and cities are defined by regions. Regions are constructed from one or more "rectangles" on the map.


The basic syntax for definining a region is as follows:


[AREADEF defname]
RECT=left, top, right, bottom, map
RECT=left, top, right, bottom, map
RECT=left, top, right, bottom, map


Properties

Within the region definition the following properties are also available to customise the behaviour of the area.

Name Read/Write Description
ANNOUNCE RW Gets or sets whether or not there will be an announcement when someone enters or exits the region.
ARENA RW Gets or sets whether or not the region is considered to be an arena.
BUILDABLE RW Gets or sets whether or not players can place buildings and ships in the region.
EVENTS regiontype_defname W Adds a region event to the region.
FLAGS RW Gets or sets the region's attributes.
GATE RW Gets or sets whether or not casting the gate travel spell is allowed in the region.
GROUP RW Gets or sets a group name for the region.
GUARDED RW Gets or sets whether or not guards can be called within the region.
MAGIC RW Gets or sets whether or not there is an anti-magic field in the region.
MARK RW Gets or sets whether or not casting the mark spell is allowed in the region.
NAME RW Gets or sets the name of the region.
NOBUILD RW Gets or sets whether or not players can place buildings in the region.
NODECAY RW Gets or sets whether or not items will decay in the region.
NOPVP RW Gets or sets whether or not PvP combat is allowed in the region.
P RW Gets or sets the location of the region (used when using the GO command).
RECALL RW Gets or sets whether or not casting the recall spell is allowed in the region.
RECALLIN RW Gets or sets whether or not it is possible to use the recall spell to enter the region.
RECALLOUT RW Gets or sets whether players can recall out of the region.
RECT left, top, right, bottom, map W Adds a rectangle to the region definition.
RESOURCES regiontype_defname W Adds a region event to the region.
SAFE RW Gets or sets whether or not the region is a safe zone.
TAG.name RW Gets or sets the value of a TAG.
UNDERGROUND RW Gets or sets whether or not the region is considered to be underground.


Examples

//
// The world region from the default script pack.
//
[AREADEF a_world]
EVENTS=r_default,r_default_rock,r_default_water,r_default_tree,r_default_grass
NAME=Felucca
GROUP=ALLMAP
P=1323,1624,55,0
RECT=0,0,7168,4096,0
//
// Lord British's Castle from the default script pack.
//
[AREADEF a_lord_britishs_castle_1]
EVENTS=r_default,r_default_rock,r_default_water,r_default_tree,r_default_grass
NAME=Lord British's Castle
GROUP=Britain
FLAGS=0648e
P=1392,1625,30,0
RECT=1294,1679,1411,1697,0
RECT=1295,1559,1313,1577,0
RECT=1392,1559,1410,1577,0
RECT=1302,1577,1410,1680,0
RECT=1313,1563,1392,1577,0
EVENTS=r_brit_castle
TAG.GUARDOWNER=Lord British's Personal