createToken: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(Created page with "{{MacroFunction |name=createToken |proposed=true |trusted=false |version=1.11.0 |description= Creates a token from the information in the required JSON object parameter. |usa...")
 
No edit summary
Line 5: Line 5:
|version=1.11.0
|version=1.11.0
|description=
|description=
Creates a token from the information in the required JSON object parameter.
Creates a token from the information in the required JSON object parameter. The JSON object must have {{code|name}} and {{code|tokenImage}} key/value pairs.


|usage=
|usage=

Revision as of 02:24, 21 November 2021

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

createToken() Function

Introduced in version 1.11.0
Creates a token from the information in the required JSON object parameter. The JSON object must have name and tokenImage key/value pairs.

Usage

createToken(param1)

Parameters

  • param1 - A JSON object as described for the updates parameter of copyToken().

Example

Create a token using an existing token image with random X/Y location.
[h: val = json.set("{}", "tokenImage", getImage("Hero"), "name", "test1","x",1d10,"y",1d10)] 
[h: id = createToken(val)]

Returns:

The ID of the created token.

See Also

Version Changes

  • 1.11.0 - First released.