Other great resources: Official JS API docs, Scripting Forum
You are viewing an old version of this page. View the current version.
Compare with Current View Page History
« Previous Version 5 Current »
// Syntax #1: Retrieve object by label: var obj = getObject(labelName); // Syntax #2: Retrieve object by location (map tile): var obj = getObject(x, y); // Syntax #3: Retrieve object by player, id and type: var obj = getObject(type, player, id);
Retrieve the object associated with the label name.
See Labels for more information.
Specify the x,y co-ordinates of a map tile to return the Structure object or Feature object on that tile.
You cannot retrieve droid objects using this syntax, as there can be more than one droid on a tile. Instead, use enumArea() or enumRange().
The type of object to retrieve:
The player to which the object belongs.
When retrieving feature objects, specify player as -1.
-1
The object ID.
Game object
Location object
The object that was retrieved.
You can determine what sort of object it is by inspecting its .type property.
undefined
null
In earlier versions of Warzone, where getObject() is not available, there are some alternatives which you can use:
3.2 early masters:
3.1 branch:
3.1 branch – filter results from:
3.1 Beta 2 → 3.1.0:
3.1 Beta 1:
var obj = getObject("foo"); // retrieve object labelled "foo" if (obj) { // do stuff with the obj }
var obj = getObject(7, 3); // retrieve structure/feature on tile 7,3 if (obj) { // do stuff with the obj }
var obj = getObject(DROID, me, 63); // retrieve my droid #63 if (obj) { // do stuff with the obj }
Requires:
See "Notes" section for details of earlier incarnations of this function.
Jump to:
Syntax 1: Labels:
Syntax 2: Location:
Syntax 3: Object IDs:
Related articles: