Overview
Excerpt |
---|
Returns a list of all labels defined in the current map file. |
Map makers can use labels as a way of passing information about their map to scripts. The labels are defined in a "labels.ini" file (example) either manually or by using Flame, the Warzone map editor. This enumLabels() Returns function gets a string list of all the label names defined in labels that exist for this map. (3.2+ only)
you then get the object associated with one of those strings using label() function
http://forums.wz2100.net/viewtopic.php?f=35&t=8965.ini (the bits in square brackets).
Labels are generally only useful in campaigns and challenges, where there are specific scripts running that know what to expect in the maps being used.
For general maps, used in skirmish and multiplayer games, I've posted some ideas about a naming convention for labels that could possibly make labels more widely applicable.
Availability
Warzone 3.2 and above.
Syntax
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
var returnValue = enumLabels(); |
Parameters
The function has no parameters.
Return value
Value | Type | Description | Game version |
---|---|---|---|
<array> | Array | An array of strings, each string being the name of a label defined in the current map's labels.ini file. Use label() to get the data associated with a label name. | 3.2 |
[] | Array | If there are no labels defined in the current map (or it has no labels.ini file) an empty array will be returned. | 3.2 |
Example
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
// get a list of all labels on this map:
var labels = enumLabel();
var labelObject;
// iterate through them and get the data associated with each label:
for (var i=0; i<labels.length; i++) {
labelObject = label(labels[i]);
// see label() function documentation for details on what the object contains
} |
See also
- label() – get object data associated for a specific label name
- Map – summary of JS API features associated with maps
- Mapping forum – forum on main warzone website where mapppers hang out