Character Vault
Any Concept / Any System
Your System Come To Life
Roll20 for Android
Streamlined for your Tablet
Roll20 for iPad
Streamlined for your Tablet

Personal tools

Script:Slide Tokens

From Roll20 Wiki

Revision as of 04:38, 13 April 2016 by Brian (Talk | contribs)

Jump to: navigation, search
API ScriptAuthor: Brian
Version: 1.2
Last Modified: 2016-04-09
Code: Slide Tokens
Dependencies: IsGM, splitArgs
Conflicts: None

Slide Tokens allows for moving tokens around the map with an API command, hitting waypoints as though the token had been dragged and the spacebar had been hit during the movement.


!movetok <args>
!mode [mode]

S → !movetok movelistargs
S → !mode mode
mode → ε
movelistargsmove movelist
movelist → ε
movelistmove movelist
direction → ε

Parameter Values
mode Optional. Set the coordinate mode for the !movetok command. If this parameter is an invalid value or omitted, the current mode will be whispered back. There are three valid values, each of which has several aliases (all case insensitive):
  • SQUARES (s, sq, square): coordinates will be in terms of grid squares
  • UNITS (u, un, unit): coordinates will be in terms of the distance measurement units (if the page scale is 5 and the grid is 1 unit, a coordinate value of 2.5 will be half a grid square)
  • ABSOLUTE (a, abs): coordinates will be in terms of pixels (70 pixels is 1 unit, so if the grid size is 1 unit, 70px will be 1 square)
args A space-separated list of position arguments. Each argument is in the form [direction:]coordinate[,coordinate].

Each coordinate is a number (which may be fractional or negative), and the second one is optional. direction is optional (default: "top-left"), and may be one of nine values (with aliases):

  • absolute (a)
  • left (l, x)
  • top (t, y)
  • right (r)
  • bottom (b)
  • top-left (tl, xy)
  • top-right (tr)
  • bottom-left (bl)
  • bottom-right (br)

If direction is "absolute", the coordinates will be treated as absolute coordinates on the map, with (0,0) being the top-left corner and all points on the map being positive values. All other directions are relative to the token.

The directions "top", "right", "bottom", and "left" will all ignore the second coordinate if it is supplied. All of the other directions will treat the second coordinate as 0 if it is not supplied.

A positive coordinate given for left directions will move the token to the right, and a positive coordinate given for top directions will move the token down; this may be unintuitive, and so using the "x" and "y" aliases is recommended. The right and bottom directions will move the token in the opposite direction to left and top if given the same coordinate values.

The !mode command may only be executed by a GM, but !movetok may be used by anyone. However, !movetok will only work with tokens you can select, meaning you must have control over it or be a GM.


As of version 1.0, the path displayed to everyone showing the waypoints the token moves is shrunk to the size of one unit (70x70 px, or one grid square with default settings) and move to the top-left corner of the GM layer for manual cleanup. A future version will remove these leftover paths automatically, as that ability is currently in testing on the development server.


v1.2 (2016-04-09)

  • Fix crash when invalid direction/no arguments supplied to !movetok
  • Update globalconfig support

v1.1 (2016-03-09)

  • Update for one-click install

v1.0 (2015-01-08)

  • Release