createTokens: Difference between revisions
Jump to navigation
Jump to search
m (Conversion script moved page CreateTokens to createTokens: Converting page titles to lowercase) |
No edit summary |
||
Line 1: | Line 1: | ||
{{MacroFunction | {{MacroFunction | ||
|name=createTokens | |name=createTokens | ||
|trusted=false | |trusted=false | ||
|version=1.11.0 | |version=1.11.0 |
Latest revision as of 16:43, 29 August 2024
createTokens() Function
• Introduced in version 1.11.0
Creates a token from the information in the required JSON array parameter. One token is created for each JSON object in the array. Each JSON object must have
name
and tokenImage
key/value pairs.Usage
createTokens(param1)
Parameters
param1
- An array of JSON objects as described for theupdates
parameter of copyToken().
Example
Create two tokens using an existing token image with random X/Y location.
[h: tok1 = json.set("{}", "tokenImage", getImage("Hero"), "name", "Hero 1","x",1d10,"y",1d10)]
[h: tok2 = json.set("{}", "tokenImage", getImage("Hero"), "name", "Hero 2","x",1d10,"y",1d10)]
[h: toks = json.append("[]", tok1, tok2)]
[r: ids = createTokens(toks)]
Returns:
A JSON array with the IDs of the created tokens.See Also
Version Changes
- 1.11.0 - First released.