Other great resources: Official JS API docs, Scripting Forum
label()
Aubergine
Owned by Aubergine
Retrieve the object associated with a label...
Syntax
var returnValue = label(labelName);
Parameters
| Parameter | Type | Mandatory | Description | Game version |
|---|---|---|---|---|
| labelName | String | The label whose associated object you want to retrieve. | 3.1 Beta 2 |
Return value
| Value | Type | Description | Game version |
|---|---|---|---|
| <object> | The object associated with the label. | 3.1 Beta 2 | |
| {} | Empty Object | If the label does not exist, an empty object is returned.
| 3.1 Beta 2 |
Example
Processing a label object
// grab the object:
var someObj = label("something");
if (!someObj.hasOwnProperty("type")) {
// no .type property = no object found
} else switch (someObj.type) {
case DROID: {
/* do stuff */
break;
}
case STRUCTURE: {
/* do stuff */
break;
}
case FEATURE: {
/* do stuff */
break;
}
case AREA: {
/* do stuff */
break;
}
case POSITION: {
/* do stuff */
break;
}
default: {
// the type of object returned is something unexpected!
}
}
Availability 3.1 B2→3.2.0
Requires:
- Warzone 3.1 Beta 2 and above.
- Deprecated in Warzone 3.2
Replaced by:
- In Warzone 3.2 and above, use getObject() instead.
Contents
Jump to:
Scripting: Labels
Related Objects:
Create them:
- addLabel() – label an object
List them:
- getLabel() – get first label associated with a specific object
- enumLabels() – get a list of all labels
Retrieve their objects:
- getObject() – get object associated with a label
- label() – use this instead on WZ 3.1
Monitor them:
- eventArea<Label>() – triggered when a droid enters a labelled Area object
- resetArea() – reset or filter an area trigger
Remove them:
- removeLabel() – remove a label