Skip to content

feat(TokenController): Rewrite for Jumpgate and Legacy games - #2361

Open
steverobertsuk wants to merge 12 commits into
Roll20:masterfrom
steverobertsuk:sr/tokencontroller-v5-0-0
Open

steverobertsuk wants to merge 12 commits into
Roll20:masterfrom
steverobertsuk:sr/tokencontroller-v5-0-0

Conversation

@steverobertsuk

Copy link
Copy Markdown
Contributor

5.0.0 (2026-10-30)

A full rewrite by MidNiteShadow7 of Developesque's TokenController, which was reported as not working in Jumpgate and no longer supported.

Fixed

  • One-Click installs work again. Version 4.0.1 was published without its 4.0.1/ folder, so installing it failed; the 4.0.0/ folder had also been overwritten with later code. Both folders now hold the code that was released under those numbers.
  • Changing anything on a patrolling token (a bar, a marker, its name) no longer takes it off its route.
  • Back-and-forth (non-cycling) routes walk back exactly the way they came. Version 4 skipped the last and first steps on the way back, so tokens drifted further away on every lap.
  • Out-of-bounds checks use the token's centre and the page's current size. Version 4 treated the centre as the top-left corner and remembered each page's size the first time it was used, so tokens near the right or bottom edge, or on resized pages, could only move in some directions. Steps off the page are now skipped without the token losing its place on the route.
  • The cell size comes from each page's grid (including cell sizes other than 1 and Jumpgate grid offsets) instead of one global Pixels Per Unit setting.
  • Reset on a single path's row only resets that path's tokens, and puts tokens back on the layer they started on instead of always the token layer.
  • A fixed start on another page reports the problem instead of failing silently (the API cannot move tokens between pages).
  • !tc list without arguments no longer throws an error. Path names with spaces work everywhere, including the menu buttons and drafts.
  • Paths made only of waits or stealth toggles, such as the built-in S Blinker, can be added.
  • The usage guide handout is GM-only. Version 4 created it visible to every player and rewrote it on every restart.
  • Lock no longer takes over the red status marker or teleports locked tokens every tick.
  • Combat detection no longer misses the first creature added to the turn order, and is remembered across API restarts.
  • Followers no longer stack on top of the leader when it patrols, and a token can no longer be made to follow itself or follow in a circle.
  • Chat is no longer flooded: actions get a short whispered reply instead of the whole menu, and menus are not stored in the chat archive.
  • Errors are reported to the GM with a hint, and logged to the API console without stopping the sandbox.

Added

  • Works in Jumpgate and Legacy games; the engine is detected automatically. No longer needs HTML Builder.
  • Routes can be made from drawings on the map (Jumpgate pathv2 and Legacy path: lines, polygons, freehand, rectangles and ellipses).
  • Routes can be recorded by moving a token with buttons or by dragging it, following Roll20 waypoints. On square grids recordings become editable step codes.
  • Diagonal steps (UL, UR, DL, DR), steps without a number (one cell) and counted waits (W3) in step codes.
  • Square, hex (V and H), isometric, dimetric and gridless pages, with a calibrate command for maps whose grid does not line up.
  • Movement setting: one cell per step (smooth) or a whole step at once (as version 4).
  • Each route runs at its own interval exactly; version 4 rounded route intervals to multiples of the global tick.
  • Combat Detection setting (turn tracker, GM switch or both) and Combat Behaviour setting (pause, move each turn or keep moving), with Combat On/Off buttons.
  • Lock Mode setting: Roll20's own position lock, undoing moves, or holding still; and a Lock Marker setting.
  • Follow Mode setting: single file or formation. Leaders can be chosen with the Leader button or by name, so @{target} is no longer needed. Followers move with tokens dragged by hand, patrolling tokens and tokens moved by TokenMod.
  • Dragging a patrolling token carries the patrol on from there (or stops it, if preferred).
  • Pause All and Resume.
  • Rename, show and per-route option buttons; removing a route asks first.
  • Turn Tokens supports token art facing any direction.
  • Status card showing what the Mod is doing and how it sees the current page's grid.
  • Public API for other Mods: TokenController.ObserveTokenChange, start, stop, reset and routeOf. Moves are passed to Hexploration v2 so patrols reveal hexes.
  • Help and Command Deck handouts in the Journal.
  • 24 languages.

Changed

  • The main command is !tokencontroller. !tc and !token-control still accept every version 4 command.
  • A token follows one route at a time; starting another route replaces the first.
  • Version 4 state is migrated on startup: paths, patrols, locks, followers, unfinished drafts and settings are kept.
  • The default interval for new games is 2 seconds, moving one cell per step.

Signed-off-by: Steve Roberts steve@shadowcomputers.co.uk

script.json listed 4.0.1 as the current version, but no 4.0.1 folder
was ever added, so One-Click installs of it failed. The 4.0.0 folder
had also been overwritten with later 4.x code.

Restore 4.0.0/ to the code released as 4.0.0 (e53c26b) and add 4.0.1/
with the code released as 4.0.1 (72dcd80), so every listed version
installs what it says.

Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
Version 5 is written as ES modules and bundled with Rollup, in line
with Hexploration and the other reworked Mods. Add the build, version
bump and locale sync scripts, Prettier settings, and the npm package
that runs them. The released version folders and the generated
script.json are excluded from formatting.

Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
TokenController was reported as not working with Jumpgate and is no
longer supported by its author. Rewrite it as version 5:

- One !tokencontroller command, with !tc and !token-control kept so
  version 4 macros still work.
- Routes from step codes, drawings (Jumpgate pathv2 and Legacy path)
  or recorded moves, run as loop, ping-pong or once.
- Square, hex, isometric, dimetric and gridless pages, using grid
  geometry measured in a Jumpgate game and the page grid offset.
- Combat detection from the turn tracker, a manual switch or both;
  lock modes (Roll20's lock, undo moves, hold still); single-file or
  formation following.
- Help and Command Deck handouts, settings as One-Click options, and
  messages in 24 languages (English for now, others to follow).
- Version 4 games are upgraded on startup, and the v4 usage guide,
  which players could see, is removed.

Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
Cover the pure grid, route and state modules directly, and run the
built bundle in a Roll20 sandbox stub with a controllable clock to
exercise patrols, following, locks, combat, recording, drawings and
the version 4 upgrade. Grid tests include positions Roll20 snapped
tokens to in a Jumpgate game.

Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
Add a README for GMs, a changelog covering every release, a developer
guide, a map of where each feature lives, and an in-game test plan
for Jumpgate and Legacy games.

Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
Build the bundle and its 5.0.0 snapshot, and update script.json with
the new version, authors, options and the full list of earlier
versions.

Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
When Google Translate rate-limited a request (HTTP 429) the script
neither retried nor reported it, and kept the English text, so whole
locales were silently written as English copies. Retry rate limits and
server errors as well as timeouts, report every failure, and don't
cache a failed string so the next sync tries it again.

Format the written files with the project's Prettier settings rather
than the defaults, so synced locales pass the format check.

Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
Machine-translate every English string into the 23 supported
languages, synced one locale at a time. Strings Google left in English
or got badly wrong (button labels, grid names and a few whole sentences
in Traditional Chinese) were translated by hand.

Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
Show the Help handout's supported languages as a table of code, name
and native name, with each language's flag as a Twemoji image. An
image is used because Roll20 on Windows shows emoji flags as pairs of
letters, as ConditionTracker found.

Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
Add each version's release date to the changelog, taken from when it
was committed. Note that the isometric and dimetric grid positions were
also measured in a Legacy game and match Jumpgate.

Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
Rebuild the bundle and its 5.0.0 snapshot with the translations and
the new language table.

Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
Date version 5.0.0 in the changelog by when its bundle was built, as
shown in the script's banner and startup message.

Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant