getTokenLayoutProps: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 2: Line 2:
|name=getTokenLayoutProps
|name=getTokenLayoutProps
|version=1.6.1
|version=1.6.1
|description= Return the token layout scale, xOffset, and yOffset as either a [[JSON Object]] or [[String Property List]].
|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=  
<source lang="mtmacro" line>
<source lang="mtmacro" line>
Line 15: Line 16:
{{param|id|The token {{code|id}} of the token to name, defaults to the [[Current Token]]. {{TrustedParameter}}}}
{{param|id|The token {{code|id}} of the token to name, defaults to the [[Current Token]]. {{TrustedParameter}}}}
{{param|mapname|The name of the map to find the token.  Defaults to the current map.}}
{{param|mapname|The name of the map to find the token.  Defaults to the current map.}}
|example=
Get the Token layout properties of the impersonated or current token.
<source lang="mtmacro" line>
[h: props = getTokenLayoutProps()]
Layout: [r: props]
</source>
'''Returns:'''
<source lang="javascript">
Layout: scale=1.3000000000000003,xOffset=4.0,yOffset=-24.0
</source>
Get the Token layout properties of the impersonated or current token separated by a semi-colon.
<source lang="mtmacro" line>
[h: props = getTokenLayoutProps(";")]
Layout: [r: props]
</source>
'''Returns:'''
<source lang="javascript">
Layout: scale=1.3000000000000003;xOffset=4.0;yOffset=-24.0
</source>
Get the Token layout properties of the specified token as a JSON object.
<source lang="mtmacro" line>
[h: props = getTokenLayoutProps("json", "Frog")]
Layout: [r: props]
</source>
'''Returns:'''
<source lang="javascript">
Layout: {"scale":1.3000000000000003,"xOffset":4.0,"yOffset":-24.0}
</source>


|also=
|also=

Revision as of 22:54, 22 March 2020

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, id)
getTokenLayoutProps(delim, id, mapName)

Parameters

  • delim - The delimiter of the String Property List. If set to json, the function will instead return a Json Object. Defaults to ,.
  • id - The token id 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

Get the Token layout properties of the impersonated or current token.
[h: props = getTokenLayoutProps()]
Layout: [r: props]

Returns:

Layout: scale=1.3000000000000003,xOffset=4.0,yOffset=-24.0

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.0;yOffset=-24.0

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.0,"yOffset":-24.0}

See Also