From RPTools Wiki
Jump to navigationJump to search

movedOverToken() Function

Introduced in version 1.3.b74
Is used to check if the location of the target token is in an array of cell coordinates like the one received from getLastPath() or the onTokenMove event's macro.args.  


movedOverToken(token, lastPath)


  • token - The target token to compare the
  • lastPath - Optional JSON array of coordinate pairs. If not supplied will use the last path of the current token.


A JSON array of cell coordinates where the moving token crossed the target token.



Check if the current token moved over a token called "Pit Trap".
[r: movedOverToken("Pit Trap")]

Returns: An array of coordinate pairs. In this case, just one.


Count how many cells of caltrops the current token moved through.

[h: lastPath = getLastPath(1)]
[h: locations = movedOverToken("Caltrops",lastPath)]
Token moved over [r: json.length(locations)] caltrops.

Returns: A count of the cells of the Caltrops token the current token moved over.

Token moved over 3 caltrops.

See Also