Other great resources: Official JS API docs, Scripting Forum
getLabel()
- Aubergine
Owned by Aubergine
Get the label, if any, associated with a game object...
Â
Syntax
var labelName = getLabel(object);
Parameters
Parameter | Type | Mandatory | Notes | Game version |
---|---|---|---|---|
object | The object to inspect. | 3.2 |
Return value
Value | Type | Notes | Game version |
---|---|---|---|
<labelName> | String | If the object has a label, the name of the label will be returned. If an object has multiple labels, only the first label found will be returned. | 3.2 |
null | Null | The object is not labelled. | 3.2 |
<error> | Error | An error occurred, most likely invalid parameters. | 3.2 |
Notes
Be careful not to call a variable "label" as that's also the name of a global function:Â label()
Example
var theLabel = getLabel(someObject);
This is a relatively slow operation of O(n) algorithmic complexity.
Availability 3.2+
Requires:
- Warzone 3.2 or above
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
Â