Other great resources: Official JS API docs, Scripting Forum
enumTemplates()
Return a list of buildable templates for the player...
Syntax
var templates = enumTemplates(player);Parameters
Parameter | Type | Mandatory | Notes | Game version |
|---|---|---|---|---|
player | Number | The player to whose templates should be listed. | 3.2 |
Return value
Value | Type | Notes | Game version |
|---|---|---|---|
<templates> | Array of | If no templates are available, an empty array is returned. | 3.2 |
<error> | Error | Most likely an invalid player was specified. | 3.2 |
Example
Sort templates by cost
var templates = enumTemplates(me);
var byCost = function(a, b) {
return a.cost - b.cost;
}
templates.sort(byCost);
var cheapest = templates[0];
var mostExpensive = templates[templates.length-1];