Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×

[Script] Token Home — Save and recall token locations, summon nearby saved tokens, or reset encounters instantly.

1777848728
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Token Home [ Video Demo ] Available on One Click Install The Token Home script allows tokens to store and recall multiple named locations on the current page. Each location records an X/Y position and the token’s layer. Tokens can be sent back to saved locations, queried, or summoned to a selected anchor point based on proximity. This script is a blow-up and glow-up of a script written for me by the Aaron, years ago. Anything about it that is broken is mine. :) Features: Store multiple locations per token (L1, L2, L3, …) Recall tokens to stored locations Preserve token layer when moving Summon tokens to a selected map object based on distance Compatible with tokens placed outside page bounds Base Command: !home Primary Commands --set   — Store the selected token’s current position as a location. --L#   — Recall the selected token to a stored location. that's an L (upper or lower case), followed by an integer. --summon   — Pull tokens to a selected anchor based on proximity. --clear   — Remove stored location data from selected tokens. --help   — Open this help handout. --macro   — Creates a generic chat menu macro that you can modify — Coming in the next merge. Location Storage Locations are identified by numbered slots: L1, L2, L3, and higher. There is no fixed upper limit. This is how I use them, but you can use whatever location logic works for you; L1 — Typically used as the token’s default location L2 — Commonly used for Residence L3 — Commonly used for Work L4 — Commonly used for Encounter Each stored location records: X position (pixels) Y position (pixels) Token layer Set Command Format: !home --set --L# Stores the selected token’s current position and layer into location L N. Rules Any number of tokens can be selected Existing data for that location is overwritten Page ID is not stored Examples, with notes in italics. I.e. don't use the notes, they are there as context for possible uses. !home --set --L1    — Set default location !home --set --L2    — Set residence !home --set --L5    —Set custom location Recall Command Format: !home --L# Moves the selected token to the stored location L N. Rules Any num ber of tokens can be selected If the location does not exist, the command aborts The token’s layer is restored Examples !home --L1 !home --L3 Summon Command The summon command pulls tokens toward a selected anchor object based on proximity to their stored locations. Format: !home --summon [--L#] [--r pixels or grid squares] if no value is given, then pixels are assumed. Use 'g' for grid squares. These are all examples of acceptable radii: --r300    = 300 pixels, --r5g    = 5 grid squares. Anchor Selection Exactly one object must be selected. That object can be a: Token (graphic) Text object (text) Map pin (pin) The selected object’s X/Y position is used as the summon target. Optional Arguments --L#     Restrict the summon to a specific stored location. --r|pixels    Maximum distance from the anchor. Default: 70. Behavior If --L# (a location) is supplied, only that location is tested If omitted, all stored locations are considered The closest matching location is used per token Distance is measured from the stored location, not current token position Tokens outside the radius are ignored Examples !home --summon !home --summon --r|210 !home --summon --L2 !home --summon --L4 --r|140 Clear Command Format: !home --clear [--L#] If --lN is supplied, only that location is removed If omitted, all stored locations are removed Chat Menu Macro I use a macro for most of these commands, which has buttons for up to 4 locations. The macro has labeled these as default, residence, work, and encounter, but you can name these however you wish. You can use and adapt this as you wish. /w gm &{template:default} {{name=Token Home}}{{Default=[Set](!home --set --l1) [Go](!home --l1) [Near](!home --summon --l1) [Radius](!home --summon --l1 --radius|?{Input number of pixels})}}{{Residence=[Set](!home --set --l2) [Go](!home --l2) [Near](!home --summon --l2) [Radius](!home --summon --l2 --radius|?{Input number of pixels})}}{{Work=[Set](!home --set --l3) [Go](!home --l3) [Near](!home --summon --l3) [Radius](!home --summon --l3 --radius|?{Input number of pixels})}}{{Encounter=[Set](!home --set --l4) [Go](!home --l4) [Near](!home --summon --l4) [Radius](!home --summon --l4 --radius|?{Input number of pixels})}}{{Summon Any=[Near](!home --summon) [Within X Pixels](!home --summon --radius|?{Input number of pixels})}} General Rules All commands are GM-only Commands operate only on the current page Tokens may be placed outside page bounds Invalid arguments abort the command
Noice! I know a couple of GMs who would find this very useful. I've sent them the link.