Versions Compared
compared with
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Div |
---|
Get a list of game objects within a specific area of the map... |
Syntax
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
// syntax #1: specify co-ordinates of area var results = enumArea( x1, y1, x2, y2[, filter[, seen]] ); // syntax #2: reference an AREA object by it's label var results = enumArea( label[, filter[, seen]] ); // syntax #3: pass in an actual AREA object var results = enumArea( areaObj[, filter[, seen]] ); |
Parameters
Syntax | Parameter(s) | Type | Mandatory | Notes | Game Version | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
#1 | x1, y1, x2, y2 | Numbers | The co-ordinates of the top left corner (x1, y1) and bottom right corner (x2, y2) of the area to search. | 3.2 | |||||||||||
#2 | label | String | The name of a label associated with an AREA object. | 3.2 | |||||||||||
#3 | areaObj | Area object | An Area object or something that has x, y, x2, y2 properties. | 3.2 | |||||||||||
All | filter | Number Constant | Optionally filter the list to a specific player (specify their player ID) or group of players (specify the Player Scope constant). Player scopes supported:
Default: ALL_PLAYERS | 3.2 | |||||||||||
All | seen | Boolean | Should the list be filtered by objects I can see?
Default: | 3.2 |
Return values
Value | Type | Notes | Game Version |
---|---|---|---|
<results> | Array of Game objects | An array of objects matching the specified criteria. Use the .type property of the objects in the array to determine what they are. | 3.2 |
[] | Empty Array | If no objects are found, an empty array is returned. | 3.2 |
<error> | Error | Invalid parameters specified, label not found or areaObj invalid. | 3.2 |
Notes
The results will also include Feature objects unless you filter to ENEMIES or ALLIES.
Example
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
// Get a list of visible enemies within specified co-ordinates var results = enumArea( 2, 3, 57, 42, ENEMIES ); // get a list of anything visible in a AREA labelled as "BASE_PERIMETER" var results = enumArea( "BASE_PERIMETER" ); // get a list of all enemies within an area defined by an area object var results = enumArea( {x:2, y:3, x2:57, y2:42, type:AREA}, ENEMIES, false ); |
Div | ||||||
---|---|---|---|---|---|---|
| ||||||
Availability
Requires:
|
Div | ||||
---|---|---|---|---|
| ||||
ContentsJump to:
|
Div | ||
---|---|---|
| ||
See alsoRelated articles:
|