Other great resources: Official JS API docs, Scripting Forum
addLabel()
- Aubergine
Owned by Aubergine
Associate a game or map object with a label...
Syntax
addLabel(object, label);
Parameters
Parameter | Type | Mandatory | Notes | Warzone Version |
---|---|---|---|---|
object | The object to label... Game objects: Location objects: | 3.2 | ||
label | String | The label will be associated with the object. | 3.2 |
Return value
Value | Type | Notes | Warzone Version |
---|---|---|---|
undefined | Undefined | The function does not return anything if sucessful. | 3.2 |
<error> | Error | An error occurred, most likely invalid parameters. | 3.2 |
Notes
When you label a Location Object, that object will be registered with the JS API. This is particularly useful in the case of AREA objects as it will trigger eventArea<Label>() whenever a droid enters the labelled area.
Example
// you can label game objects... var firstTruck = enumDroid(me, DROID_CONSTRUCT)[0]; addLabel(firstTruck, "my_first_truck"); // you can also register new location objects by labelling them... var myArea = {x:10, y:11, x2:20, y2:21, type:AREA}; addLabel(myArea, "TriggerZone"); // which is useful for creating area triggers at runtime... function eventAreaTriggerZone() { // do stuff when area is entered // see also: resetArea() }
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