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

Personal tools

Difference between revisions of "Script:Slide Tokens"

From Roll20 Wiki

Jump to: navigation, search
m
 
(4 intermediate revisions by one user not shown)
Line 2: Line 2:
 
|name=Slide Tokens
 
|name=Slide Tokens
 
|author={{user profile|235259|Brian}}
 
|author={{user profile|235259|Brian}}
|version=1.0
+
|version=1.2
|lastmodified=2015-02-21
+
|lastmodified=2016-04-09
|dependencies={{api repository link|IsGM Auth Module}}, {{api repository link|splitArgs}}}}
+
|dependencies={{api repository link|IsGM}}, {{api repository link|splitArgs}}}}
  
'''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.
+
'''Slide Tokens''' allows for moving tokens around the map with an API command, hitting waypoints as though the token had been dragged and the Q had been hit during the movement.
 
<div style="clear:both"></div>
 
<div style="clear:both"></div>
  
Line 14: Line 14:
 
{{API command|mode}} {{API parameter|name=mode|optional=true}}
 
{{API command|mode}} {{API parameter|name=mode|optional=true}}
 
{{Formal API command|
 
{{Formal API command|
{{token|S}} {{rarr}} {{API command|movetok}} {{token|movelist|-}}
+
{{token|S}} {{rarr}} {{API command|movetok}} {{token|movelistargs|-}}
 
{{token|S}} {{rarr}} {{API command|mode}} {{token|mode|-}}
 
{{token|S}} {{rarr}} {{API command|mode}} {{token|mode|-}}
 
{{token|mode}} {{rarr}} {{epsilon}}
 
{{token|mode}} {{rarr}} {{epsilon}}
 
{{token|mode}} {{rarr}} {{string|-}}
 
{{token|mode}} {{rarr}} {{string|-}}
 +
{{token|movelistargs}} {{rarr}} {{token|move}} {{token|movelist|-}}
 +
{{token|move}} {{rarr}} {{token|direction}}{{token|coordinates|-}}
 
{{token|movelist}} {{rarr}} {{epsilon}}
 
{{token|movelist}} {{rarr}} {{epsilon}}
 
{{token|movelist}} {{rarr}} {{token|move}} {{token|movelist|-}}
 
{{token|movelist}} {{rarr}} {{token|move}} {{token|movelist|-}}
{{token|move}} {{rarr}} {{token|direction}}{{token|coordinates|-}}
 
 
{{token|direction}} {{rarr}} {{epsilon}}
 
{{token|direction}} {{rarr}} {{epsilon}}
 
{{token|direction}} {{rarr}} {{string}}:<br>
 
{{token|direction}} {{rarr}} {{string}}:<br>
Line 61: Line 62:
  
 
=== Changelog ===
 
=== Changelog ===
 +
{{changelog version|1.2|2016-04-09|* Fix crash when invalid direction/no arguments supplied to !movetok
 +
* Update globalconfig support}}
 +
{{changelog version|1.1|2016-03-09|* Update for one-click install}}
 
{{changelog version|1.0|2015-01-08|* Release}}
 
{{changelog version|1.0|2015-01-08|* Release}}

Latest revision as of 17:59, 14 August 2018

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 Q had been hit during the movement.

[edit] Syntax

!movetok <args>
!mode [mode]
Formally:

S → !movetok movelistargs
S → !mode mode
mode → ε
modestring
movelistargsmove movelist
movedirectioncoordinates
movelist → ε
movelistmove movelist
direction → ε
directionstring:
coordinatesfloat
coordinatesfloat,float

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.

[edit] Notes

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.

[edit] Changelog

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