getTokenLayoutProps: Difference between revisions
m (Conversion script moved page GetTokenLayoutProps to getTokenLayoutProps: Converting page titles to lowercase) |
m (Text replacement - "<source" to "<syntaxhighlight") |
||
Line 5: | Line 5: | ||
|usage= | |usage= | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
getTokenLayoutProps() | getTokenLayoutProps() | ||
getTokenLayoutProps(delim) | getTokenLayoutProps(delim) | ||
Line 19: | Line 19: | ||
|example= | |example= | ||
Get the Token layout properties of the impersonated or current token. | Get the Token layout properties of the impersonated or current token. | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[h: props = getTokenLayoutProps()] | [h: props = getTokenLayoutProps()] | ||
Layout: [r: props] | Layout: [r: props] | ||
</source> | </source> | ||
'''Returns:''' | '''Returns:''' | ||
< | <syntaxhighlight lang="javascript"> | ||
Layout: scale=1.3000000000000003,xOffset=4,yOffset=-24 | Layout: scale=1.3000000000000003,xOffset=4,yOffset=-24 | ||
</source> | </source> | ||
Get the Token layout properties of the impersonated or current token separated by a semi-colon. | Get the Token layout properties of the impersonated or current token separated by a semi-colon. | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[h: props = getTokenLayoutProps(";")] | [h: props = getTokenLayoutProps(";")] | ||
Layout: [r: props] | Layout: [r: props] | ||
</source> | </source> | ||
'''Returns:''' | '''Returns:''' | ||
< | <syntaxhighlight lang="javascript"> | ||
Layout: scale=1.3000000000000003;xOffset=4;yOffset=-24 | Layout: scale=1.3000000000000003;xOffset=4;yOffset=-24 | ||
</source> | </source> | ||
Get the Token layout properties of the specified token as a JSON object. | Get the Token layout properties of the specified token as a JSON object. | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[h: props = getTokenLayoutProps("json", "Frog")] | [h: props = getTokenLayoutProps("json", "Frog")] | ||
Layout: [r: props] | Layout: [r: props] | ||
</source> | </source> | ||
'''Returns:''' | '''Returns:''' | ||
< | <syntaxhighlight lang="javascript"> | ||
Layout: {"scale":1.3000000000000003,"xOffset":4,"yOffset":-24} | Layout: {"scale":1.3000000000000003,"xOffset":4,"yOffset":-24} | ||
</source> | </source> |
Revision as of 20:16, 14 March 2023
getTokenLayoutProps() Function
scale
, xOffset
, and yOffset
values in either a JSON Object or String Property List. These values represent the positioning of the token image within the Layout portion of the Config tab in the Edit Token Dialog.Usage
<syntaxhighlight lang="mtmacro" line> getTokenLayoutProps() getTokenLayoutProps(delim) getTokenLayoutProps(delim, id) getTokenLayoutProps(delim, id, mapName) </source>
Parameters
delim
- The delimiter of the String Property List. If set tojson
, the function will instead return a Json Object. Defaults to,
.id
- The tokenid
of the token to name, defaults to the Current Token.Note: This parameter can only be used in a Trusted Macro.
mapname
- The name of the map to find the token. Defaults to the current map.
Example
<syntaxhighlight lang="mtmacro" line> [h: props = getTokenLayoutProps()] Layout: [r: props] </source> Returns: <syntaxhighlight lang="javascript"> Layout: scale=1.3000000000000003,xOffset=4,yOffset=-24 </source>
Get the Token layout properties of the impersonated or current token separated by a semi-colon. <syntaxhighlight lang="mtmacro" line> [h: props = getTokenLayoutProps(";")] Layout: [r: props] </source> Returns: <syntaxhighlight lang="javascript"> Layout: scale=1.3000000000000003;xOffset=4;yOffset=-24 </source>
Get the Token layout properties of the specified token as a JSON object. <syntaxhighlight lang="mtmacro" line> [h: props = getTokenLayoutProps("json", "Frog")] Layout: [r: props] </source> Returns: <syntaxhighlight lang="javascript"> Layout: {"scale":1.3000000000000003,"xOffset":4,"yOffset":-24}
</source>