Versions Compared

Key

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

...

Excerpt

List all objects within a

...

specified range of a

...

position on the map...

 

...

Syntax

Code Block
themeRDark
languagejavascript
linenumberstrue
var results = enumRange(x, y, range

...

 

player can be id or things like ENEMIES, ALLIES, etc.

...

[, filter[, seen]]);

Parameters

ParameterTypeMandatoryNotesGame Version
xNumber(tick)The x co-ordinate of the position3.2
yNumber(tick)The y co-ordinate of the position3.2
rangeNumber(tick)The range, in map tiles, from the position to search for objects3.2
filter

Number

Constant

(error)

Optionally filter the list to objects owned by a specific player ID or a category of players:

Child pages (Children Display)
alltrue
depthall
pagePlayer Scope
excerpttrue

Default: ALL_PLAYERS

3.2
seenBoolean(error)

Should the list be filtered to objects you can see?

  • true – yes, filter to visible objects
  • false – no, return all objects

Default: true

3.2

Return values

ValueTypeNotesGame Version
<results>Array of
Game objects
A list of objects matching the specified criteria. Use their .type property to determine what sort of object they are.3.2
[]Empty ArrayIf no objects are found, an empty array is returned.3.2
<error>ErrorInvalid parameters or map loctation.3.2

Notes

The returned list will include Feature objects unless you filter to ENEMIES or ALLIES.

Example

Code Block
themeRDark
languagejavascript
linenumberstrue
// get a list of all enemies within 10 tiles of (20,30)
var results = enumRange(20, 30, 10, ENEMIES, false);
 
results.forEach( function(gameObject) {
	switch (gameObject.type) {
		case DROID: {
			// do stuff with droid
			break;
		}
		case STRUCTURE: {
			// do stuff with structure
			break;
		}
	}
} );
Div
classbox
Availability
Status
colourYellow
title3.2+

Requires:

  • Warzone 3.2 or above
Div
classbox
Contents

Jump to:

Table of Contents
maxLevel5

Div
classbox

See also

Related articles: