moveToken

From MapToolDoc
Jump to: navigation, search

moveToken() Function

Introduced in version 1.3b51

Move a token to a new location.

Usage

  1. moveToken(x, y)
  1. moveToken(x, y, units)
  1. 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 to false(0), the coordinates are a location on the grid in cells. Defaults to true(1), where the coordinates are in Distance Per Cell pixels.
  • 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.

  1. [h: CurrentX = getTokenX()]
  2. [h: CurrentY = getTokenY()]
  3. [h: NewX = CurrentX + 5]
  4. [h: NewY = CurrentY - 10]
  5. [h: moveToken(NewX, NewY)]

Moves the Current Token down 5 cells, and left 10 cells.

  1. [h: CurrentX = getTokenX(0)]
  2. [h: CurrentY = getTokenY(0)]
  3. [h: NewX = CurrentX + 5]
  4. [h: NewY = CurrentY - 10]
  5. [h: moveToken(NewX, NewY, 0)]

See Also

getTokenX(), getTokenY()