Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Excerpt

Associate a game or map object with a label...

 

Syntax

Code Block
themeRDark
languagejavascript
linenumberstrue
addLabel(object, label);

Parameters

ParameterTypeMandatoryNotesWarzone Version
object

Game Objectobject

Location Object

(tick)

The object to label...

Game objects:

Location objects:

3.2
labelString(tick)

The label will be associated with the object.

3.2

Return value

ValueTypeNotesWarzone Version
undefinedUndefinedThe function does not return anything if sucessful.3.2
<error>ErrorAn 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

Code Block
themeRDark
languagejavascript
linenumberstrue
// 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()
}
Div
classbox
Availability
Status
colourYellow
title3.2+

Requires:

  • Warzone 3.2 or above
Div
classbox
Contents

Jump to:

Table of Contents
maxLevel5

Include Page
.jslinks-labels
.jslinks-labels