Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3
Excerpt

Returns an array of feature objects (like trees and boulders), optionally filtered to a specific looking player...

 

Syntax

Code Block
themeRDark
languagejavascript
linenumberstrue
var returnValue = enumFeature([viewer[, featureID]]);

Parameters

ParameterTypeMandatoryDescriptionGame version
viewerNumber(error)

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

Defaults to me.

You can specify -1 which means "don't filter based on viewer" so you get a list of all features on the map. In more recent Warzone versions you can specify ALL_PLAYERS to get a similar effect.

3.1 Beta 1
featureIDString

(warning) 3.1

(error) 3.2+

Optionally filter the list to features of a specific type as defined by their feature ID.

You can get a list of feature IDs from the first column in features.txt

In Warzone 3.1 RC3 and earlier:

  • If no parameters are specified, defaults to listing everything (no filtering).
  • If the viewer parameter is specified, defaults to listing nothing (everything gets filtered out) unless you specify "" (empty string)

In Warzone (question) 3.2 and above:

  • Defaults to listing all features (no filtering) regardless of whether viewer parameter is specified or not.

3.1 Beta 1

Bug fixed in Warzone (question)3.2

Return value

ValueTypeDescriptionGame version
<array>Array of
Feature object
An array of matching Feature objects3.1 Beta 1
[]Empty ArrayIf no matching features are found, you get an empty array.3.1 Beta 1
<error>ErrorIf the viewer does not exist, or you specify an invalid feature ID, an error is thrown.3.1 Beta 1

Example

var visibleFeatures = enumFeature();
Code Block
themeRDark
languagejavascript
titleGet a list of all my droids
linenumberstrue
linenumberstrue
// get a list of all features I can see
var visibleFeatures = enumFeature();
 
// get a list of all features on the map
var allFeatures = enumFeature(ALL_PLAYERS, ""); // WZ 3.1
var allFeatures = enumFeature(ALL_PLAYERS); // WZ 3.2
Div
classbox
Availability
Status
colour
Green
Yellow
title
Stable
3.1 b1+

Requires:

  • Warzone 3.1 Beta 1 or above
  • The featureID parameter is optional Updated in Warzone (question) and above3.2
Div
classbox
Contents

Jump to:

Table of Contents
maxLevel5

Div
classbox

See also

Related articles:

  • Features – quick reference to all JS API stuff relating to features
  • Feature object – enumFeatures() returns a list of these objects
  • enumBlips() – get a list of radar detector blips on the map
  • enumDroid() – get a list of droids on the map
  • enumStruct() – get a list of structures on the map