moveToken: Difference between revisions
Jump to navigation
Jump to search
Verisimilar (talk | contribs) (Added examples and some clarification.) |
Verisimilar (talk | contribs) mNo edit summary |
||
Line 18: | Line 18: | ||
* {{code|x}} - The X coordinate to move the token to. | * {{code|x}} - The X coordinate to move the token to. | ||
* {{code|y}} - The Y coordinate to move the token to. | * {{code|y}} - The Y coordinate to move the token to. | ||
* {{code|units}} - If set to {{false}}, the coordinates are a location on the grid in '''cells'''. Defaults to {{true}}, where the coordinates are ''Distance Per Cell'' '''units'''. | * {{code|units}} - If set to {{false}}, the coordinates are a location on the grid in '''cells'''. Defaults to {{true}}, where the coordinates are in ''Distance Per Cell'' '''units'''. | ||
* {{code|id}} - The id [[Macros:Variables:string|string]] of the token to move, defaults to the [[Current Token]]. | * {{code|id}} - The id [[Macros:Variables:string|string]] of the token to move, defaults to the [[Current Token]]. | ||
Revision as of 12:01, 29 April 2009
moveToken() Function
• Introduced in version 1.3b51
Move a token to a new location.
Usage
moveToken(x, y)
moveToken(x, y, units)
moveToken(x, y, units, id)
Parameters
x
- The X coordinate to move the token to.y
- The Y coordinate to move the token to.units
- If set tofalse
(0
), the coordinates are a location on the grid in cells. Defaults totrue
(1
), where the coordinates are in Distance Per Cell units.id
- The id string of the token to move, defaults to the Current Token.
Examples
Moves the Current Token down
5
units, and left 10
units.
[h: CurrentX = getTokenX()]
[h: CurrentY = getTokenY()]
[h: NewX = CurrentX + 5]
[h: NewY = CurrentY - 10]
[h: moveToken(NewX, NewY)]
Moves the Current Token down 5
cells, and left 10
cells.
[h: CurrentX = getTokenX(0)]
[h: CurrentY = getTokenY(0)]
[h: NewX = CurrentX + 5]
[h: NewY = CurrentY - 10]
[h: moveToken(NewX, NewY, 0)]