moveTokenFromMap: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Corrected usage syntax.)
No edit summary
 
(7 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{stub|Examples of usage, and clearer description.}}
{{stub|Examples of usage, and clearer description.}}
{{MacroFunction
{{MacroFunction
|name=moveTokenFrom
|name=moveTokenFromMap
|trusted=true
|trusted=true
|version=1.3b54
|version=1.3b54
Line 8: Line 8:


|usage=
|usage=
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
moveTokenFromMap(id, map, x, y, z)
moveTokenFromMap(tokenRef, map)
</source>
moveTokenFromMap(tokenRef, map, x)
moveTokenFromMap(tokenRef, map, x, y)
moveTokenFromMap(tokenRef, map, x, y, z)
</syntaxhighlight>
'''Parameters'''
'''Parameters'''
{{param|id|The token {{code|id}} or a [[JSON Array]] of token {{code|id}}s of the token/s to move.}}
{{param|tokenRef|Either the token [[getSelected|{{code|id}}]] or [[getTokenName|Token Name]] of the token or a [[JSON Array]] of token {{code|id}}s of the token/s to move.}}
{{param|map|A string containing the name of the map that the token is moved from.}}
{{param|map|A string containing the name of the map that the token is moved from.}}
{{param|x|The {{code|X}} coordinate of the current map that the token should be moved to.}}
{{param|x|The {{code|X}} coordinate of the current map that the token should be moved to. Defaults to 0.}}
{{param|y|The {{code|Y}} coordinate of the current map that the token should be moved to.}}
{{param|y|The {{code|Y}} coordinate of the current map that the token should be moved to. Defaults to 0.}}
{{param|z|The z-order that the token should have after being moved.}}
{{param|z|The z-order that the token should have after being moved. Defaults to the largest of the 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.}}


|also=
|also=
Line 22: Line 26:


}}
}}
[[Category:Token Function]][[Category:Map Function]]

Latest revision as of 21:14, 17 May 2024

 This article is a stub, you can help the RPTools Wiki project by contributing content to expand this article.
 This article needs: Examples of usage, and clearer description.

moveTokenFromMap() Function

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

Introduced in version 1.3b54
Moves tokens from a specified map to the current map.

Usage

moveTokenFromMap(tokenRef, map)
moveTokenFromMap(tokenRef, map, x)
moveTokenFromMap(tokenRef, map, x, y)
moveTokenFromMap(tokenRef, map, x, y, z)

Parameters

  • tokenRef - Either the token id or Token Name of the token or a JSON Array of token ids of the token/s to move.
  • map - A string containing the name of the map that the token is moved from.
  • x - The X coordinate of the current map that the token should be moved to. Defaults to 0.
  • y - The Y coordinate of the current map that the token should be moved to. Defaults to 0.
  • z - The z-order that the token should have after being moved. Defaults to the largest of the 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.


See Also