From RPTools Wiki
Jump to navigation Jump to search

 Note: This refers to a proposed change that has not been implemented in the main code base yet.

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.




  • param1 - An array of JSON objects as described for the updates parameter of copyToken().


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)]


A JSON array with the IDs of the created tokens.

See Also

Version Changes

  • 1.11.0 - First released.