getTokenRotation: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 15: Line 15:
getTokenRotation()
getTokenRotation()
getTokenRotation(id)
getTokenRotation(id)
getTokenRotation(id, mapname)
</source>
</source>


'''Parameters'''
'''Parameters'''
{{param|id|The token id of the token to retrieve the rotation angle.  Defaults to the [[Current Token]].}}{{TrustedParameter}}
{{param|id|The token id of the token to retrieve the rotation angle.  Defaults to the [[Current Token]].}}{{TrustedParameter}}
{{param|mapname|The name of the map to find the token.  Defaults to the current map.}}
'''Result'''<br />
'''Result'''<br />
The function returns the token's rotation as a numeric value measured in degrees.
The function returns the token's rotation as a numeric value measured in degrees.
Line 36: Line 39:
|also=
|also=
[[getTokenFacing]]
[[getTokenFacing]]
|changes=
{{change|1.5.4|Added {{code|mapname}} parameter option.}}
}}
}}
[[Category:Token Function]]
[[Category:Token Function]]

Revision as of 20:46, 15 August 2019

getTokenRotation() Function

Introduced in version 1.5.0
Retrieves the angle of rotation for the token from the default position. Returned value is in degrees.

For Square, Round or Figure token types, this is the change in the facing indicator from the default of 0 degrees or no change in facing. Positive is CW and negative is CCW. Values will range from -270 to +85.

For Top Down tokens, this is the rotation of the token image itself from the default of 0 degrees.

Usage

getTokenRotation()
getTokenRotation(id)
getTokenRotation(id, mapname)

Parameters

  • id - The token id of the token to retrieve the rotation angle. 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.

Result
The function returns the token's rotation as a numeric value measured in degrees.

Example

Get the rotation for the four tokens shown below.
[h: switchToken("Mage")]
[r: token.name] - [r: r = getTokenRotation()]<br>
[h: switchToken("Elf")]
[r: token.name] - [r: r = getTokenRotation()]<br>
[h: switchToken("Hero")]
[r: token.name] - [r: r = getTokenRotation()]<br>
[h: switchToken("Troll")]
[r: token.name] - [r: r = getTokenRotation()]

Returns:

File:getTokenRotation.png

See Also

Version Changes

  • 1.5.4 - Added mapname parameter option.