Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview

Excerpt

Returns an array of structure objects, optionally filtered to a specific player, structure type and looking player.

Availability

Warzone 3.1 Beta 1 and above.

Note, however, that there have been several changes to the Structure objects that are returned by this function.

Syntax

Code Block
themeEclipse
languagejavascript
linenumberstrue
var returnValue = enumStruct([player[,

...

 structTypeOrID[,

...

 viewer]]])

...

;

Parameters

ParameterTypeMandatoryDescriptionGame version
playerNumber(error)

The ID number of the player who's structures you want to list.

Defaults to me.

3.1 Beta 1

structTypeOrID

Constant

or

String

(error)

The type of structure you want to list, usually specified by it's .stattype constant:

Child pages (Children Display)
alltrue
depthall
page.stattype
excerpttrue

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
viewerNumber(error)

List structures that a specific player can see (eg. on their sensors), with the player specified by their player ID.

Defaults to -1 which means "don't filter based on viewer".

3.1 Beta 1

Return value

ValueTypeDescriptionGame version
<array>ArrayAn array of Structure objects3.1 Beta 1
[]ArrayIf no matching structures are found, you get an empty array.3.1 Beta 1
<error>ErrorIf the player/viewer or droid type specified is incorrect, an error is thrown.3.1 Beta 1

Example

Code Block
themeEclipse
languagejavascript
linenumberstrue
// get a list of all my structures
var myStructures = enumStruct();
Code Block
themeEclipse
languagejavascript
linenumberstrue
// build a list of all enemy structures, regardless of whether we can see them or not
var enemyStructs = [];
 
playerData.forEach(function(player) {
  if (!allianceExistsBetween(me,player)) { // enemy player
    enemyStructs = enemyStructs.concat(enumStruct(player));
  }
});

See also

  • Structures – quick reference to all JS API stuff relating to structures
  • enumBlips() – get a list of radar detector blips on the map
  • enumDroid() – get a list of droids on the map
  • enumFeature() – get a list of features on the map
  • enumStructOffWorld() – similar to enumStruct(), but gets a list of structures that aren't on the current map (used in campaigns when doing off-world missions)