flipTokenX: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(Added page.)
 
m (Updated "map" parameter to "mapRef" in Usage and Parameters.)
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{MacroFunction
{{MacroFunction
|name=flipTokenX
|name=flipTokenX
|proposed=true
|trusted=true
|trusted=true
|version=1.10.0
|version=1.10.0
Line 10: Line 9:
|usage=
|usage=
<syntaxhighlight lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
flipTokenX() - current token
flipTokenX()
flipTokenX(token) - specify token by name or ID
flipTokenX(tokenRef)
flipTokenX(token, map) - specify token and map
flipTokenX(tokenRef, mapRef)  
</syntaxhighlight>
</syntaxhighlight>
'''Parameters'''
'''Parameters'''
{{param|token|Name or ID of token to change}}
{{param|tokenRef|Either the token [[getSelected|{{code|id}}]] or [[getTokenName|Token Name]] of the token to change}}
{{param|map|Map the token is located on}}
{{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.}}


'''Returns'''
'''Returns'''
Line 43: Line 43:
* '''1.10.0''' - Added function.
* '''1.10.0''' - Added function.
}}
}}
[[Category:Token Function]]

Latest revision as of 09:58, 24 November 2024

flipTokenX() Function

 Note: This function can only be used in a Trusted Macro

Introduced in version 1.10.0
Last checked for compatibility with version 1.10.0
Flip the current token image horizontally like the right-click menu option.

Usage

flipTokenX()
flipTokenX(tokenRef)
flipTokenX(tokenRef, mapRef)

Parameters

  • tokenRef - Either the token id or Token Name of the token to change
  • 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.


Returns 0

Example

Flip the current token horizontally.
[h: flipTokenX()]

Flip the "Stairs Down" token on map "Level 1".

[h: flipTokenX("Stairs Down", "Level 1")]

Clear flipped status.

[h, if(isFlippedX() == 1):flipTokenX()]

See Also

Version Changes

  • 1.10.0 - Added function.