getTokenY

From MapToolDoc
Jump to: navigation, search

getTokenY() Function

Introduced in version 1.3b51

Gets the Y coordinate for a token.

Usage

  1. getTokenY()
  1. getTokenY(units)
  1. getTokenY(units, id)

Parameters

  • units - If set to false(0), the coordinate is a location on the grid in number of cells. Defaults to true(1), where the coordinate is in number of Pixels (in other words 0:distance in cells, 1: distance in pixels)'.
  • id - The id of the token to move, defaults to the Current Token.

Which coordinate is returned for tokens larger then one cell

 Note: This refers to a proposed change that has not been implemented in the main code base yet.
 Details:
The marked exception will disappear.

  • With the exception of one case the coordinates of the cell are given where the UPPER LEFT CORNER of the image of the token is in at that moment.
  • The exception to this is when the token is 'Freesize' AND 'Snapped to Grid' AND NOT 'On Background Layer'. In that particular case the coordinates of the cell where the upper left corner of the FOOTPRINT (NOT image) of the token is at. The footprint can be recognized when you move the token on the Token layer, it will leave the white marker on the field. The footprint can be the same size as the image and it is if a preset size is used. With freesize however the size of the footprint is either the original size of the image OR when you have used a preset (e.g. 'large') it will have the size of the preset as footprint.
  • Note that if you rotate the image such that the image is no longer in the upper left corner, the upper left corner of its native position is still returned as its coordinate.

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

moveToken(), getTokenX(), getZoom(), setZoom().