Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Excerpt |
---|
List structures on the current map... |
Syntax
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
var structures = enumStruct([player[, |
...
structTypeOrID[, |
...
viewer]]]) |
...
; |
Parameters
Parameter | Type | Mandatory | Description | Game version | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
player | Number | The ID number of the player who's structures you want to list. Defaults to me. | 3.1 Beta 1 | |||||||||||
structTypeOrID | Constant String | The type of structure you want to list, usually specified by it's .stattype constant:
You can alternatively specify a structure type by it's ID as defined in structures.txt If the parameter is not specified, structures of all types will be returned. | 3.1 Beta 1 | |||||||||||
viewer | Number | List structures that a specific player can see (eg. on their sensors), with the player specified by their player ID. Defaults to ALL_PLAYERS which means "don't filter based on viewer". | 3.1 Beta 1 |
Return value
Value | Type | Description | Game version |
---|---|---|---|
<array> | Array of Structure objects | If structures matching the criteria are found, an array of structure objects will be returned. | 3.1 Beta 1 |
[] | Array | If no matching structures are found, you get an empty array. | 3.1 Beta 1 |
<error> | Error | If the player/viewer or structure type specified is incorrect, an error is thrown. | 3.1 Beta 1 |
Example
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
// get a list of all my structures
var myStructures = enumStruct(); |
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
var enemyStructs = [];
playerData.forEach( function(player) {
if ( !allianceExistsBetween(me, player) ) { // enemy player
enemyStructs = enemyStructs.concat(enumStruct(player));
}
} ); |
Div | ||
---|---|---|
| ||
In the early beta releases bug #3123 prevented scripts from getting lists of scavenger droids and structures. See scavengerPlayer for some ideas as to how to deal with that. |
Div | ||
---|---|---|
| ||
There have been numerous changes to Structure objects across various Warzone versions. |
Div | ||||||
---|---|---|---|---|---|---|
| ||||||
Availability
Requires:
|
Div | ||||
---|---|---|---|---|
| ||||
ContentsJump to:
|
Div | ||
---|---|---|
| ||
See alsoRelated articles:
|