getTokenLayoutProps: Difference between revisions
Jump to navigation
Jump to search
(Created page with "{{MacroFunction |name=getTokenLayoutProps |version=1.6.1 |description= Return the token layout scale, xOffset, and yOffset as either a JSON Object or String Property List....") |
No edit summary |
||
(9 intermediate revisions by 4 users not shown) | |||
Line 2: | Line 2: | ||
|name=getTokenLayoutProps | |name=getTokenLayoutProps | ||
|version=1.6.1 | |version=1.6.1 | ||
|description= Return the | |description= Return the Token Layout {{code|scale}}, {{code|xOffset}}, and {{code|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= | |usage= | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
getTokenLayoutProps() | getTokenLayoutProps() | ||
getTokenLayoutProps(delim) | getTokenLayoutProps(delim) | ||
getTokenLayoutProps(delim, | getTokenLayoutProps(delim, tokenRef) | ||
getTokenLayoutProps(delim, | getTokenLayoutProps(delim, tokenRef, mapRef) | ||
</ | </syntaxhighlight> | ||
'''Parameters''' | '''Parameters''' | ||
{{param|delim|The delimiter of the String Property List. If set to {{code|json}}, the function will instead return a Json Object. Defaults to {{code|,}}.}} | {{param|delim|The delimiter of the String Property List. If set to {{code|json}}, the function will instead return a Json Object. Defaults to {{code|,}}.}} | ||
{{param| | {{param|tokenRef|Either the token [[getSelected|{{code|id}}]] or [[getTokenName|Token Name]] of the token to name, defaults to the [[Current Token]]. {{TrustedParameter}}}} | ||
{{param| | {{param|mapRef|The Name or ID of the map to find the token. Defaults to the current map.}} | ||
{{Note|Token IDs are unique, but Token Names can be duplicated. Using Token Name when more than one token has the same name can produce unexpected results.}} | |||
|example= | |||
Get the Token layout properties of the impersonated or current token. | |||
<syntaxhighlight lang="mtmacro" line> | |||
[h: props = getTokenLayoutProps()] | |||
Layout: [r: props] | |||
</syntaxhighlight> | |||
'''Returns:''' | |||
<syntaxhighlight lang="javascript"> | |||
Layout: scale=1.3000000000000003,xOffset=4,yOffset=-24 | |||
</syntaxhighlight> | |||
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] | |||
</syntaxhighlight> | |||
'''Returns:''' | |||
<syntaxhighlight lang="javascript"> | |||
Layout: scale=1.3000000000000003;xOffset=4;yOffset=-24 | |||
</syntaxhighlight> | |||
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] | |||
</syntaxhighlight> | |||
'''Returns:''' | |||
<syntaxhighlight lang="javascript"> | |||
Layout: {"scale":1.3000000000000003,"xOffset":4,"yOffset":-24} | |||
</syntaxhighlight> | |||
|also= | |also= | ||
{{func| | {{func|setTokenLayoutProps}} | ||
}} | }} | ||
[[Category:Token Function]] | [[Category:Token Function]] |
Latest revision as of 23:59, 11 May 2024
getTokenLayoutProps() Function
• Introduced in version 1.6.1
Return the Token Layout
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
getTokenLayoutProps()
getTokenLayoutProps(delim)
getTokenLayoutProps(delim, tokenRef)
getTokenLayoutProps(delim, tokenRef, mapRef)
Parameters
delim
- The delimiter of the String Property List. If set tojson
, the function will instead return a Json Object. Defaults to,
.tokenRef
- Either the tokenid
or Token Name of the token to name, defaults to the Current Token.Note: This parameter can only be used in a Trusted Macro.
mapRef
- The Name or ID of the map to find the token. Defaults to the current map.
Token IDs are unique, but Token Names can be duplicated. Using Token Name when more than one token has the same name can produce unexpected results.
Example
Get the Token layout properties of the impersonated or current token.
[h: props = getTokenLayoutProps()]
Layout: [r: props]
Returns:
Layout: scale=1.3000000000000003,xOffset=4,yOffset=-24
Get the Token layout properties of the impersonated or current token separated by a semi-colon.
[h: props = getTokenLayoutProps(";")]
Layout: [r: props]
Returns:
Layout: scale=1.3000000000000003;xOffset=4;yOffset=-24
Get the Token layout properties of the specified token as a JSON object.
[h: props = getTokenLayoutProps("json", "Frog")]
Layout: [r: props]
Returns:
Layout: {"scale":1.3000000000000003,"xOffset":4,"yOffset":-24}