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 .
Advertisement Create a free account Compendium in Game, Join Today

[Script] Teleport - from scratch teleport token.

1604675136

Edited 1609447273
Pat
Pro
API Scripter
Teleport is up in one-click. Basic screens available Examples of use cases&nbsp; Cross-page Teleport setup using Global Teleport Pad List New version 1.2.2 is up on one-click , but only works properly (as version 1.2.2 with all features) if imported instead of added . ^ This has been corrected and it should now work from one-click. Thanks to The Aaron!&nbsp; This version keeps tokens which are trying to move off of a teleport token and don't make it in a single movement, or are on a very large target pad and move around within it, from teleporting inadvertently.&nbsp; Link to post Version 1.2.1 This version corrects a crash due to invalid data being present in a teleport token, and keeps player tokens from auto-teleporting if they are already on a teleport pad and have a graphic:change &nbsp;event other than movement (rotation, add condition, etc).&nbsp;&nbsp; Also, has a query button to confirm removing deleted teleport pad references from all other teleport pads.&nbsp; Also a fix for cross-page teleport (still unstable, still a work in progress) (legacy installation instructions for in-development gist )&nbsp; <a href="https://app.roll20.net/forum/post/9436375/script-teleport-from-scratch-teleport-token/?pageforid=9460991#post-9460991" rel="nofollow">https://app.roll20.net/forum/post/9436375/script-teleport-from-scratch-teleport-token/?pageforid=9460991#post-9460991</a> The current version supports: Creating teleport pad tokens. Names do not have to be special and are expressly so the creator can identify them, and can be changed at any time. Teleporting a selected token to a teleport pad with chat buttons Setting up auto-teleport by setting a teleport pad's destination to another teleport pad Setting up two-way auto-teleports (pads that are linked to each-other) Setting up many-to-one teleports (many teleport pads can have the same target teleport pad) Setting up one-to-many teleports (one teleport pad has many targets; toggle between random (a random target pad is selected out of the many targets) (default) and select (token's player is presented with a list of the destination teleport pads as a list of the names given to a teleport pad in a chat button) Setting up token keys on teleport pads (status indicators) that player tokens have to match to auto-teleport (this does not stop GM manual teleport through the chat menu) A special feature where having one or more destination tokens from a one-to-many with token keys prevents them from showing up in the select list. I.e. if the player doesn't have matching status indicators, a destination is kept "secret" from the drop-down. Cross-page teleport: all of the above features supported for cross-page teleport. Caution: &nbsp;the API implementation appears to not have the same status as the drag-drop implementation. Much like the jukebox, where a track started by the Jukebox controls can't be turned off by the API, an individual player ribbon moved by drag-drop cannot be moved by API . Additionally, API individual player ribbon moves are not retained if the player logs off/leaves the game as normal , unlike drag-drop operations. A returning player who was on another page due to API will be automatically re-merged with the main Player ribbon. We are investigating the difference at this time, but it appears the API has lost its access to the "real" player status. Individual teleport pads can have special effects selected from a series of drop-down menus to perform effects when a player auto-teleports to them.&nbsp; Player tokens that teleport through the GM using the chat buttons or through auto-teleport get an invisible individual ping by default. The invisible ping is performed by temporarily setting their player color to "transparent" and then re-setting it after the ping.&nbsp; Individual teleport pads have optional text that is activated in chat on a player token auto-teleporting. It does not activate on the GM chat button teleport, since it is from a "sending" pad. Sending pads send chat to text, receiving pads activate optional special effects. Individual teleport pads can be restricted from their usual auto-teleport (if they have a linked pad) without deactivating all auto-teleport by turning them off through the chat button menu. This does not stop GM chat button activation, just auto-teleport.&nbsp; Hello, new scripter here.&nbsp; Yes, there are teleport scripts out there - I wanted to try creating one instead of modifying one, so I started from scratch. The algorithm for detecting a token intersecting with a teleport pad is not complete, but teleport pad management I think is coming along nicely. Using this menu system, you can create one-way portals, chained portals, chained portals that flow into one-another (many-to-one in one direction), the plan is for including one-to-many as a randomizer (you will eventually be able to link one portal to a list of other potential portals: if it detects more than one linked portal, it goes into randomizer mode). It has portal locking, but not portal keys yet (I need to look into how to implement this with custom tokens, for example), and placeholder functions for special FX and text output. It is mostly through chat buttons, you can copy and paste portals too as all of the data is stored in the token.&nbsp; I hope to keep updating this thread with the most current version and have people give feedback. Once pasted in and running, type "!teleport --help" to get started. Hopefully the chat buttons and navigation are clear, the small buttons have mouseover text/titles to explain their function, and I've included chat messages for common fail conditions.&nbsp;&nbsp; Edited to add: New checks and features on multi-selected target pads. Link to Installation Instructions:&nbsp; <a href="https://app.roll20.net/forum/post/9436375/script-teleport-from-scratch-teleport-token/?pageforid=9460991#post-9460991" rel="nofollow">https://app.roll20.net/forum/post/9436375/script-teleport-from-scratch-teleport-token/?pageforid=9460991#post-9460991</a>
1604677014
The Aaron
Forum Champion
API Scripter
Nice Pat!&nbsp; I look forward to seeing what you come up with.&nbsp; I've been wanting an alternative to the much hacked and quirky existing teleport script.&nbsp;&nbsp;
1604685050
Can't wait to try this out, Pat! Looks great.
1604694424

Edited 1604782315
Pat
Pro
API Scripter
Thanks folks - I've added the feature that if you select multiple target pads: when clicking the "link pad" button on a pad, it will put in a list of target pads - haven't fixed the display part yet (showing which pads are linked when it is multiple) (this part is working too) - and then when using auto-teleport, will randomize between the target pads. You could use this with the pads back linking to the hub to present a random-jump-out, return to hub setup.&nbsp; In other words: One-way supported (Drops, holes, traps) One-to-one supported (pads that link to one-another: doors, floors, passageways) Flow supported (teleports going one way around a circle (one-way flow, rivers, teleport cycles)) Many-to-one supported (many ports leading to a central room/pad) One-to-many supported with randomize (branching random) A few things I'm thinking of: currently, teleport pads can only link to other teleport pads - but there's nothing limiting a pad from connecting to any other kind of entity on any layer (there is no layer check - and I could get rid of the teleport pad check). In other words, you could create a bunch of one-way teleports by linking teleport pads to just ordinary map tokens or tokens that are movable characters, even. If you want to use the buttons, though, it still has to be a teleport token on the GM layer.&nbsp; Update: Modified the collision status so any overlap causes teleport - I'm thinking of putting in a buffer, because if a token is rotated, it sometimes teleports when it is next to but not looking like it is overlapping (it is, but by only a few pixels). What's a good buffer, is my question?&nbsp; Update: Modified the collision status so circular profile determines teleport - this fixed some edge cases for me where the overlap was... not evident but still happening. May put in a buffer or an adjustable buffer (overlap has to exceed x) if anybody wants it.&nbsp; Put in edit screen for individual pads where you can set the SFX from chat-based drop-downs, test the SFX, test the ping, teleport (again to test if everything is working), and have validated that the SFX is happening too. It should fire up the help on sandbox, I can make that adjustable and dismissable if it gets annoying, or store it in state when the last pop-up was (say, no more than once every 24 hours?) Should I:&nbsp; have it prompt for name on creating a new pad? make the name editable the same way as sfx? Add the linking editing to the individual pad editing?&nbsp; add message editing (create message, edit message) for teleport messages to all in chat? add message editing to include whispers to the target instead of all?&nbsp; Current Script: (changing to git repository link) <a href="https://github.com/Gritmonger/roll20-teleport/blob/main/teleport.js" rel="nofollow">https://github.com/Gritmonger/roll20-teleport/blob/main/teleport.js</a>
1604783731

Edited 1604786121
Pat
Pro
API Scripter
Updated to version 0.9 Alpha Release Save and it should boot up with a help screen, click from there. Any questions please reply here.&nbsp; Edit: Added name pad to create pad, check so a pad that is already a teleport pad isn't re-initialized.&nbsp; <a href="https://github.com/Gritmonger/roll20-teleport/blob/main/teleport.js" rel="nofollow">https://github.com/Gritmonger/roll20-teleport/blob/main/teleport.js</a>
1604804798

Edited 1605243662
Pat
Pro
API Scripter
Installation and Use:&nbsp; Open the API Scripts page for your current game. Click on the "New Script" tab.&nbsp; Paste the code from&nbsp; <a href="https://github.com/Gritmonger/roll20-teleport/blob/main/teleport.js" rel="nofollow">https://github.com/Gritmonger/roll20-teleport/blob/main/teleport.js</a> Save the code. On returning to your game, you should see this: Click on the "Main Menu" button, and you should see this:&nbsp; You can then select any token on the tabletop, new or one that's already there, that you'd like to use as the portal. Click on "Create Teleport Pad" - You must be on the current player ribbon page to have the next step work. If you are not, the portal pad will be created , but it will not show up in the list until you move the player ribbon to that page . You will get a pop-up on the tabletop:&nbsp; A default name is provided, you can edit and paste in your own instead. Your token will be named this and have the needed attributes added to it and be moved to the GM Layer (gmlayer). The Teleport Pad List will then pop-up and show your new portal in the list, and its status. It is not linked to anything when created.&nbsp; To link it, select another portal token. Repeat steps 7-10 to create another teleport pad.&nbsp; Select the portal you want to link your portal to Click on the link button on the listing of your first portal The linked portal will be listed. This link is only one-way, and is only for the purposes of auto-teleport. If you want to link the target portal back to the original portal, repeat this process selecting the first portal and clicking the link on the panel for the second portal.&nbsp; To teleport a tabletop token (character or monster token), select the token you want to teleport, then click on the "Teleport Token" button adjacent to the portal you want to send them to.
1604806924
Pat
Pro
API Scripter
Installation and Use (Continued) If you've lost track of which portal pad is which (GM Layer assets can be hard to spot on complex backgrounds) or can't remember where you left a portal pad on the GM Layer, click "Ping Pad"&nbsp; If you want to lock a pad from players being able to auto-teleport from it, click the "Lock Pad" button. The color and wording of the button will change (to "Unlock Pad") and the pad will have the "dead" token status marker applied. The "Edit Pad" button gives you access to other more specific aspects of a portal pad that you are less likely to need to change as often. It opens the "Pad Edit" panel for that specific portal pad.&nbsp; You can return to the complete pad list by pressing the spiral button next to the title. This panel is incomplete, but has the interface for adding and editing the special effects for a portal (which trigger on arrival at the portal either from auto-teleport or from button-initiated teleport) Currently the pad has no special effects (SFX) selected.&nbsp; Click on "Set Pad SFX" A tabletop pop-up will appear with the list of SFX shapes listed in a drop-down. Select one and press "Submit" Another pop-up will appear with the default list of SFX color schemes. Select one and press "Submit" The SFX name now appears, and you can click the "Show SFX" button to test whether or not it appears and if it has the appearance you want. (Results of pressing Show SFX)
1604836300
David M.
Pro
API Scripter
Can't wait to try this out!
1604845236
The menu interface for this looks super, Pat. Will definitely try this out.&nbsp;
1604855861
Pat
Pro
API Scripter
Thanks, Aaron, David, and Jay - Jay, I'm currently working on an add-message interface per what you mentioned before - trying to figure out a good way for a person to add a placeholder for including the token name in the message - was thinking of a format like [target] for placeholder text in a phrase - would you expect it to whisper just to the target, to announce to everyone? A different whispered message versus public? The message to be for the autoteleport *start* or the autoteleport *destination*?&nbsp;
1604865039

Edited 1604865483
Pat
Pro
API Scripter
Usage and Features Multi-Target and Randomizer for Auto-Teleport Have a group of target portals - two or more - that you would like to target from another teleport pad. Select them as a group - either by single-select or selecting as an area. Then click "Link Pad"&nbsp;&nbsp; All of the other pads are added, and displayed as a comma-delimited list:&nbsp; On auto-teleport, all pads are weighted equally, and one of the four is selected at random. Instead of testing each pad as it comes up (which might result in heavier weighting for the first pad in the list), the position is selected prior to running through the valid target pads. A series of randomly teleporting pads can be created by performing this with all pads, meaning all of them link to one-another, randomly, and no pattern exists for teleporting between any of them. Edited to add: All links are set up by token ID, so re-naming any portal does not unlink it, or cause you to have to re-link a portal.&nbsp;
1604957798

Edited 1604957828
Pat
Pro
API Scripter
Usage and Features There are four configuration options - many of which can be implemented individually on portals by including or omitting features - but which can be universally controlled from the configuration panel. On the Main Menu, click on "Config Panel."&nbsp; You will be taken to the Configuration Menu.&nbsp;&nbsp; To toggle the features listed Campaign-wide, click on one of the buttons. For example: Click on "SHOWSFX" SHOWSFX changes to a red x, indicating that it is disabled. You can test this by using a portal that autoteleports or selecting a token and pressing the teleport button in the control panel - no SFX should result. This does not keep you from assigning and testing SFX, just from them showing up in normal use. These settings will be retained from session to session (as configuration settings in the state object).&nbsp;
1604984194

Edited 1604994108
Pat
Pro
API Scripter
Still working on it - considering adding a flag to allow a drop-down to select a destination pad instead of random if a flag is set. Default is random, flag set is drop-down (so on arriving on the pad, the player is set with a select box with all pads linked from the autoteleport, and on selecting one a message is sent to teleport them to the selected portal.&nbsp; Would that be something people might want or use?&nbsp; I've implemented this and it's on the main download on git Select the Edit Details for a pad with multiple linked pad targets Click on "Multi-Link: Random" row button labeled "Set Select Pad" It should change appearance and now read "Select":&nbsp; Now, when a token that is controlled by a player or the GM moves over the pad with multiple linked pads, a button is whispered to the controlling player:&nbsp; On clicking the button, a pop-up with a drop down of all linked portals is presented:&nbsp; Selecting a portal and clicking "Submit" will teleport the token to the selected linked teleport pad.&nbsp;
1604995766

Edited 1604996422
Pat
Pro
API Scripter
Recent Changes Rename You can rename the teleport pads from the edit teleport pad menu.&nbsp; Message There is a basic "Message" setting for each pad - you can test it currently, but it is not working on automatic teleport, due to not being sure when it should activate (on the target pad or the initiating pad) Multi-Select and Random Setting A toggle sets up the ability for one-to-many teleports to go between random (all equally-weighted choices, randomly selected target) and select (the token controlling player is whispered a button to activate a select list of destinations from the linked portals).&nbsp; This allows for things like a connected circular staircase that has openings at every floor, an elevator (for science-fiction/modern settings), networked portals between destinations, etc.&nbsp;
1605012474
Pat
Pro
API Scripter
The Aaron said: Nice Pat!&nbsp; I look forward to seeing what you come up with.&nbsp; I've been wanting an alternative to the much hacked and quirky existing teleport script.&nbsp;&nbsp; Thanks - I have a specific ask of you, if you wouldn't mind: - I want to implement what you added to the older Teleporter script, with keys via token status indicators - I understand there is not an easy way to pull in graphics to have somebody select, and that the comparison can be labor-intensive especially with the custom token status indicators; I'd still like to provide an in-chat version of adding, removing, and indicating - any advice?&nbsp;
1605019694
This looks amazing! I can't wait to try it. One question, does it work across different pages?
1605021894
Pat
Pro
API Scripter
Doug E. said: This looks amazing! I can't wait to try it. One question, does it work across different pages? Not yet. The idea is to eventually allow page-to-page teleportation, I'm trying to make this beginner friendly and super easy to set up - so telling somebody they have to make copies of all of the tokens that might teleport and store them in the GM layer, or make sure all the images they want to use for tokens are uploaded only flies in the face of that.&nbsp; Other than that part, linking tokens across pages was done accidentally, so in theory it could work - just have to split off the player from the main ribbon and activate the ping and sfx in the context of the target page (a few more checks and attributes).&nbsp;
1605024559
I'm getting an error message consistently after clicking on the Teleporter Pad List button, or when the script is calling the Pad List after creating a new teleport pad: TypeError: padCheck.get(...).indexOf is not a function TypeError: padCheck.get(...).indexOf is not a function at apiscript.js:15574:46 at Function.each (/home/node/d20-api-server/node_modules/underscore/underscore.js:188:9) at teleportPadList (apiscript.js:15573:15) at padDisplay (apiscript.js:15389:21) at msgHandler (apiscript.js:15699:21) at eval (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:154:1), &lt;anonymous&gt;:65:16) at Object.publish (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:154:1), &lt;anonymous&gt;:70:8) at /home/node/d20-api-server/api.js:1661:12 at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560 at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147) I installed (copied and pasted) directly from Github version '0.9 Alpha Release':&nbsp;<a href="https://github.com/Gritmonger/roll20-teleport/blob/main/teleport.js" rel="nofollow">https://github.com/Gritmonger/roll20-teleport/blob/main/teleport.js</a>
1605025175

Edited 1605026491
Pat
Pro
API Scripter
Jarren K. said: I'm getting an error message consistently after clicking on the Teleporter Pad List button, or when the script is calling the Pad List after creating a new teleport pad: TypeError: padCheck.get(...).indexOf is not a function TypeError: padCheck.get(...).indexOf is not a function at apiscript.js:15574:46 at Function.each (/home/node/d20-api-server/node_modules/underscore/underscore.js:188:9) at teleportPadList (apiscript.js:15573:15) at padDisplay (apiscript.js:15389:21) at msgHandler (apiscript.js:15699:21) at eval (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:154:1), &lt;anonymous&gt;:65:16) at Object.publish (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:154:1), &lt;anonymous&gt;:70:8) at /home/node/d20-api-server/api.js:1661:12 at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560 at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147) I installed (copied and pasted) directly from Github version '0.9 Alpha Release':&nbsp; <a href="https://github.com/Gritmonger/roll20-teleport/blob/main/teleport.js" rel="nofollow">https://github.com/Gritmonger/roll20-teleport/blob/main/teleport.js</a> What kind of object are you trying to turn into a teleport pad? Is it a drawing? Because this is trying to pull the "bar1_value" attribute, and this error indicates that whatever is selected has no bar1_value attribute... I thought I caught this with checks for the create pad restricted to type graphic and subtype token, but I may have to check for isDrawing too.&nbsp; Got a similar error, not the same, when I tried to use a path, but did not get this error on using a graphic dragged to the tabletop, animate, drawing, or other designation.&nbsp; Edit: It may have been other objects on the GM layer - it pulls all of them that are subtype token and on the same page id as the player ribbon - I put in a check for objects it pulls in to make sure the attribute exists and is a string instead of "undefined" - hope that fixes it. New version up on Github. @Jarren K., can you give the new code a shot?&nbsp;
1605031064
I was initially using a transparent token, then I tried a torch token just to make sure it wasn't some issue with the token itself.&nbsp; I just tried the new code, and I'm not getting any error or API shutdown, but the pads that are created aren't showing up in the Teleport Pad List either. I can send you a link to my test game to see if that helps!
1605044800

Edited 1605044845
Pat
Pro
API Scripter
More thoughts: one downside with the button presented to a player to allow them to select a teleportation target when they hit a multi-select is that they might be tempted to up-arrow and keep a teleportation button handy for later use. So, if there was a single-use key attached to that button (issued when they move their character onto the relevant portal) that would be destroyed on use, they couldn't re-use a button to select a level -they'd have to get a new one issued each time. And that would have to be indexed per character in case another character used the same pad before the first player had cashed in their key.&nbsp; I wouldn't have to check for "is GM" in those cases, because keys either get used or destroyed. There's also the case of cancelling - if they invoke a key and then cancel, I would never know - so in the case of a player, if they request a new key, the old key would be destroyed (only one stored per player at a time).&nbsp;
1605114007

Edited 1605115746
Pat
Pro
API Scripter
Update Changes: Added Message interface to edit pad panel - Open the Pad Edit Panel: There is no Message. Click on Set Pad Message An interface pops up to fill in the Message:&nbsp; You can use the keyword [target] (with square brackets) to provide a place for the message return to put in the token name. Submit this response.&nbsp; The message appears in the Pad Edit Panel.&nbsp; You can click on the small speech bubble button (Show Message) to have the example message whispered in chat to the GM as a test.&nbsp; You have to select a target token first, then click on Show Message.&nbsp; The chat message appears with [target] replaced by the token name.&nbsp; On a token auto-teleporting through this portal, an open formatted message appears from the initiating portal . &nbsp; The message is sent (currently) in open chat on activation of an auto-teleport pad, and is drawn from the initiating pad. Special effects, conversely, are activated on arrival at a target pad from another auto-activation pad.&nbsp; The specific text of [target] can be inserted into the text to provide a placeholder for the teleporting token's name attribute, which will be dynamically substituted in. This is not a requirement, it is an additional feature of creating a message template.&nbsp; There is not a global attribute to suppress messages, or a toggle to whisper messages only to the teleporting token. It might be too much to have separate messages for global and for token whisper, there are a limited number of text-containing attributes on a token, and I prefer to keep them all within that paradigm to make copying teleport pads between pages easy.&nbsp;
1605167276
Pat
Pro
API Scripter
Update Changed styles, fonts, and layouts Added support for emoji icons that require Variation-Selector-16 and Zero-Width-Joiner in combination Changed a lot of fixed measurements to relative (supports zoom without breaking) Caught for error conditions in attempts to turn drawings or text into teleport pads
1605203872

Edited 1605205182
Pat
Pro
API Scripter
Update Adding token markers as keys for pads Token will have to have the same keys as the pad to activate auto-teleport This could also be applied to targeted portals in one-to-many: a selected list (or in random) meaning the keys would apply to linked portals and not just the auto-teleport portal (making for an elevator with a "hidden" section you can pull a keycard for, for instance...) &lt;= &nbsp;Is this something people would find useful, or confusing?&nbsp; Adding in-chat editing of keys (in progress)&nbsp;
1605215150

Edited 1605215801
Pat
Pro
API Scripter
Update Added token status marker editing to pads.&nbsp; Select Edit Pad from the pad list.&nbsp; Note that the pad has token status markers, and that the token status markers are reflected in the pad details (called "Keys") Select the "Show Keys" button to the right of the listed keys.&nbsp; You are taken to the Pad Keys Edit panel. Note that the active keys (token status markers) on the pad token are highlighted in gray. To activate a new key, click on an unhighlighted key (token status marker).&nbsp; The new key is added to the pad token.&nbsp; To de-activate a key, click on an active key (token status marker) To return to the pad edit, click on the pencil emoji at the upper right of the Pad Keys Edit panel.&nbsp; The new key settings are reflected in the Pad Edit panel and on the Pad Token.&nbsp;
1605220092

Edited 1605229170
Pat
Pro
API Scripter
Update Version 1.0 Beta Release Candidate - all features present, would appreciate some testing beyond what I've been doing.&nbsp; <a href="https://github.com/Gritmonger/roll20-teleport/blob/main/teleport.js" rel="nofollow">https://github.com/Gritmonger/roll20-teleport/blob/main/teleport.js</a> Now - locking portals prevent use if keys on player tokens do not match portal tokens.&nbsp; Additionally: if there is a one-to-many select relationship, keys are also evaluated for whether a portal appears on the drop-down list. For instance, if you have a set of two keys required to activate the one-to-many select portal, you get the select list; if any of the portals require different keys that the token does not have, they do not appear on the list. This does not affect one-to-many random portals, as those by their nature are more likely to be random-one-way-until-one-finds-the-key portals.&nbsp; Portal "Deadly Portal" is linked to all four other portals, and is set to multi-link select.&nbsp; Two of the portals it is linked to have keys. The player token has no keys, currently.&nbsp; On entering autoteleport for Deadly Portal, the token's player gets a pop-up that, because of the keys required, only shows two of the four possible target portals:&nbsp; We add one of the keys (token status markers) to the player token and try again... Now, when we move the token over Deadly Portal again, the list includes portals with keys the player token also has:&nbsp; &nbsp; ...and the portal that the player has a key for now appears in the list.&nbsp;
1605224615
Whoa, Pat, you've been busy! I want to try this script out tonight. I'll report back with any issues I find.
1605228886
So I can't get the script to work. I drag a token onto the desktop, select, run the Create Pad option. It renames the token, moves it to the GM layer, and sets the nameplate to visible, but the pad does not appear in the list and I have none of the options to edit, link, etc. This is the error I get in the API window: ""Invalid character_id&nbsp; for getAttrByName()"
1605229278

Edited 1605229549
Pat
Pro
API Scripter
Jay R. said: So I can't get the script to work. I drag a token onto the desktop, select, run the Create Pad option. It renames the token, moves it to the GM layer, and sets the nameplate to visible, but the pad does not appear in the list and I have none of the options to edit, link, etc. This is the error I get in the API window: ""Invalid character_id&nbsp; for getAttrByName()" Okay, that's puzzling because I'm not referencing attributes at any point if I recall, especially in create teleport pad. Any other clues? Are you running other scripts at the same time?&nbsp; Edit: Did a code search, there are no calls to getAttrByName
1605229440
Pat said: Jay R. said: So I can't get the script to work. I drag a token onto the desktop, select, run the Create Pad option. It renames the token, moves it to the GM layer, and sets the nameplate to visible, but the pad does not appear in the list and I have none of the options to edit, link, etc. This is the error I get in the API window: ""Invalid character_id&nbsp; for getAttrByName()" Okay, that's puzzling because I'm not referencing attributes at any point if I recall, especially in create teleport pad. Any other clues? Are you running other scripts at the same time?&nbsp; I am running a bunch of other scripts. I was hoping not to have to disable them all and test one by one, lol. But I suppose I should.
1605229677

Edited 1605230048
Pat
Pro
API Scripter
May be a conflict with something watching for token bar value attribute changes - the teleport status is set by setting the bar1_value of the token, and if there is another script watching to update an associated character sheet automatically, it might look for a character sheet and fail (the pad tokens have no associated character sheets). Edit: or if it is creating sheets automatically for any token that is dragged to the tabletop, then assigning a value of "teleport" to the bar1_value would be illegal for a numeric stat.&nbsp;
1605230381
Pat said: May be a conflict with something watching for token bar value attribute changes - the teleport status is set by setting the bar1_value of the token, and if there is another script watching to update an associated character sheet automatically, it might look for a character sheet and fail (the pad tokens have no associated character sheets).&nbsp; Have disabled every script except Teleporting and I'm still not seeing the pad in the Teleport Pad List menu. The invalid character id message is gone, but the script just does nothing.
1605230875
Ok, created a blank game from scratch with nothing but the Teleport script ... and it works. Huh.
1605230981

Edited 1605231125
Pat
Pro
API Scripter
Jay R. said: Ok, created a blank game from scratch with nothing but the Teleport script ... and it works. Huh. Right - it sounds like something happened that stopped the bar1_value being set and that will kill it being picked up as a portal pad, so no removal of any other scripts after that would have helped. Can you try in the original game to create a portal and see if it works? If you want to try and "correct" the original portal, enter "teleport" into the bar1_value slot. It may not take - if you do it manually it might have a bunch of HTML entities...&nbsp;
1605231539
Pat said: Jay R. said: Ok, created a blank game from scratch with nothing but the Teleport script ... and it works. Huh. Right - it sounds like something happened that stopped the bar1_value being set and that will kill it being picked up as a portal pad, so no removal of any other scripts after that would have helped. Can you try in the original game to create a portal and see if it works? If you want to try and "correct" the original portal, enter "teleport" into the bar1_value slot. It may not take - if you do it manually it might have a bunch of HTML entities...&nbsp; I'll try, but when testing in the original game, I tried with a fresh token (dragged onto the desktop) every time, so there should have been no issue. But maybe the gods will be on my side this time. :)
1605231781
Pat
Pro
API Scripter
Jay R. said: I'll try, but when testing in the original game, I tried with a fresh token (dragged onto the desktop) every time, so there should have been no issue. But maybe the gods will be on my side this time. :) Interesting thing - the only thing the "create pad" checks for besides token type (no cards, no non-graphics) is that attribute - so if it's not being set, you can attempt to re-initialize a pad token on the GM layer by selecting it and attempting "Create Token" again.&nbsp;
1605231930
No luck. Also, bar1 is being picked up by the script. It changes to teleport without problem. It's just that the token doesn't show up in the list. Also, that invalid error earlier was, I realize, from just dragging a token from the marketplace onto the desktop.
1605232132

Edited 1605232384
Pat
Pro
API Scripter
Hold on - are you on the active player ribbon? Right now it's fixed to that only. It was a necessity to make sure you didn't try and link to another page on accident... I can add a chat message if you create a token on a page the player ribbon is not on to explain that... I don't think we can "get" which page the GM is on currently.&nbsp; If this turns out to be the issue, I'll fix that with another message and you can turn all your scripts back on and give it a try. Eventually I may add another layer to select pages that have portals... as I'm hoping one day the fetters will be released and we can set new graphics with marketplace images and all be free to teleport page to page.&nbsp;
1605232675

Edited 1605232787
Ahhhhhh, not on the active player ribbon. Damn. Will try right now. Edit: SWEET JESUS, it works!! That is definitely something you want to mention early and often in the documentation. :)
1605233134

Edited 1609258660
Pat
Pro
API Scripter
Jay R. said: Ahhhhhh, not on the active player ribbon. Damn. Will try right now. Edit: SWEET JESUS, it works!! That is definitely something you want to mention early and often in the documentation. :) I put it in the script, actually - latest version now detects if you're creating portals on the non-player-ribbon page, and sends you a message letting you know that it won't show up until the player ribbon is moved to the page.&nbsp; Edit: Great to hear it works! Now you can re-enable all the other scripts and stress test it :)&nbsp; Edited again: Added it to the opening help text as well, just in case the messages are missed.&nbsp; Edited one last time: The portal display per page now defaults to the gm-player _lastpage attribute, so no longer any need for the messages or warnings or alerts.&nbsp;
1605233941
Pat said: Jay R. said: Ahhhhhh, not on the active player ribbon. Damn. Will try right now. Edit: SWEET JESUS, it works!! That is definitely something you want to mention early and often in the documentation. :) I put it in the script, actually - latest version now detects if you're creating portals on the non-player-ribbon page, and sends you a message letting you know that it won't show up until the player ribbon is moved to the page.&nbsp; Edit: Great to hear it works! Now you can re-enable all the other scripts and stress test it :)&nbsp; Yep, already reenabled those scripts and it seems to work fine. I really dig the UI, and the linking method, even though it's slightly counterintuitive, is nice once you figure it out (select portal to be linked but click the link portal button on the first portal). So far, everything seems present and correct, though I haven't tried random portals or anything. I very much appreciate being able to specify custom text/fx for each portal. That's going to be a godsend.
1605234356

Edited 1605235222
Pat
Pro
API Scripter
Jay R. said: Pat said: Jay R. said: Ahhhhhh, not on the active player ribbon. Damn. Will try right now. Edit: SWEET JESUS, it works!! That is definitely something you want to mention early and often in the documentation. :) I put it in the script, actually - latest version now detects if you're creating portals on the non-player-ribbon page, and sends you a message letting you know that it won't show up until the player ribbon is moved to the page.&nbsp; Edit: Great to hear it works! Now you can re-enable all the other scripts and stress test it :)&nbsp; Yep, already reenabled those scripts and it seems to work fine. I really dig the UI, and the linking method, even though it's slightly counterintuitive, is nice once you figure it out (select portal to be linked but click the link portal button on the first portal). So far, everything seems present and correct, though I haven't tried random portals or anything. I very much appreciate being able to specify custom text/fx for each portal. That's going to be a godsend. The UI was the point with this, really - I wanted a new player unfamiliar with API to be able to activate the script, easily add portal pads, easily manage them (know they are there, test their workings without having to teleport, find them on a cluttered tabletop, provide an easy interface to teleport directly as well as by autoteleport) so if you were able to start it up and get it working without too much trouble I'm very pleased :)&nbsp; Edit : here's a hint for linking two portals : Select them both, then click link. A portal won't link to itself , so if you have two portals, just group-select and click on each one's link button, and you're all set.&nbsp;
1605244896
I think this was the same issue I was having! Pat said: Hold on - are you on the active player ribbon? Right now it's fixed to that only. It was a necessity to make sure you didn't try and link to another page on accident... I can add a chat message if you create a token on a page the player ribbon is not on to explain that... I don't think we can "get" which page the GM is on currently.&nbsp; If this turns out to be the issue, I'll fix that with another message and you can turn all your scripts back on and give it a try. Eventually I may add another layer to select pages that have portals... as I'm hoping one day the fetters will be released and we can set new graphics with marketplace images and all be free to teleport page to page.&nbsp;
1605248569

Edited 1605248590
Pat
Pro
API Scripter
Jarren K. said: I think this was the same issue I was having! If it was, download the newest version which has several mentions of that limitation, and all the locking and key features! Thanks for testing this out!&nbsp; <a href="https://github.com/Gritmonger/roll20-teleport/blob/main/teleport.js" rel="nofollow">https://github.com/Gritmonger/roll20-teleport/blob/main/teleport.js</a>
1605285195

Edited 1605320499
Pat
Pro
API Scripter
Update Next Steps: [X] Code clean-up and documentation [X] Turning Help into a handout [X] Coding menu button into handout Fixed bug related to multi-link set to Select with only one target link Final request for feedback before commit to 1.0 release.&nbsp; Figuring out how to make the associated page and content if it needs to go into oneclick (never done this before, other Teleporter was never in one-click)&nbsp;
1605313197

Edited 1605320741
Pat
Pro
API Scripter
Okay, I'll admit I'm lost when it comes to trying to get this into one-click, and I'm not sure if I should be doing that. I'm not an api scripter. I've been reading the documentation, but it all refers to checking in and out character sheets, not API scripts.&nbsp;
1605331810

Edited 1609447431
Pat
Pro
API Scripter
Teleport is ready. Try it out by downloading it from here . Visual assets in these examples are Gabriel Pickard map packs and assorted elements.&nbsp; Here are some example use-cases if you're curious how you might use this script in your game. Summoning a Monster An unlinked portal with a monster token on the GM layer. The portal has SFX specified, so when the monster on the GM layer is selected, and the portal is invoked with "Teleport Token" - it moves the monster to the center of the teleportation token and moves it to the object layer, and the SFX executes.If you have an otherworldly portal that regularly disgorges monstrosities until the players close it, this can aid in that setup.&nbsp; Pits, Holes and Traps Set up two pads - one at the top of the hole, one at the bottom. Use Dynamic Lighting to set up a separate section of the page, and set up the bottom of the hole in a walled-off area that otherwise is inaccessible. Connect the top with the bottom, but don't connect the bottom back to the top. When a player "enters" the hole, if they fall in they take fall damage, and are stuck in a different section of the map from the other players.&nbsp; Two Floors in a House Set up a separate section of the map to represent the second floor, like the hole example from above. Unlike the hole, link the two floors to each-other. In this example, there are two sets of stairs - the first and second floor of the main building, and the first and second floor of the tower. An easy way to set this up is to select both portals on the gmlayer and click the link on one. A portal won't link to itself, so doing this means the "right" portal will link. Repeat this for the other portal. This allows players to navigate two floors of a building on their own, either in or out of combat.&nbsp; A Coded Locked Door / Secret Door Set up a standard two-way portal pad - two linked portals. On one side, set a key (token status marker). This is hidden on the gmlayer, so a player cannot see what is necessary to enter the portal pad. The other way doesn't have to have this, so the player can freely exit once they have entered. Getting Washed Downstream Set up a series of teleport points at different intervals where a person might catch themselves in a current. Link each portal to the next portal in the series (River Spot 1 links to River Spot 2, River Spot 2 links to River Spot 3). Re-entering the current carries them further "downstream" (to the next portal), but not back in the flow, until they reach a shallows, or a waterfall...&nbsp; Getting Lost in a Magical Portal Forest Portal pads can be linked to more than one other portal. When this is done, Teleport randomizes which destination portal gets selected. If you do this for a series of sets of portals, or link a bunch of portals all to each-other, two different players going through the same portal pad are unlikely to end up at the same place. In this version, it is easiest to select all portals together each time on the gmlayer and click "link" on each portal. Again, a portal will not link to itself, so no worries on thinking about which portal pad to exclude. Sit back and watch the fun.&nbsp; Elevator or Spiral Stairs Selecting multiple other pads as linked pads, like in the previous example can be set to select instead of random, prompting the user with a set of destinations to teleport to, which functions for a spiral staircase or an elevator.&nbsp;
1605433570

Edited 1605437350
Pat
Pro
API Scripter
I am not sure at all if I did it right, but I tried to add this to the roll20 api git repository. I guess we'll know in a few days if it gets picked up with the Monday update.&nbsp; Nope, I'm sure I screwed this up. I have no idea what I'm doing with this, so maybe next week. Right now I'm tired after making this attempt.&nbsp;
1605435387

Edited 1605435492
Pat
Pro
API Scripter
As an addendum - the interface is to try and make creating portals easier. You do not have to modify portals through the interface - you can set and remove keys through the normal interface, the pad token edit just means you don't have to swap layers to do so (you can stay on the token layer and modify the keys from the chat menu). All of the attributes, if you know the right ones, can be written from elsewhere or other programs or can be modified from other token modification programs. I used "fliph" (a true-false toggle) to determine if the multi-target is random or select. For the most part, the rest of the entries are on the token barN_value and barN_max.&nbsp; The criteria used for pulling a list of teleport pads are:&nbsp; Is it a token on the gm layer? Does it have "teleportpad" as its beginning in token.bar1_value, and is it on the current playerpageid? Those are the criteria - hopefully this means it won't pick up accidental other teleport pads, and it means the name can be changed without affecting pad linking or status.&nbsp; Also, since it is an entirely chat-based button interface, all of the processed commands are there in chat with an up-arrow if you want to create your own macro button that includes the button call, but don't want to deal with the interface.&nbsp;
1605452911
I really like the use cases you mentioned in the updated docs, Pat. Simulating someone getting washed downstream or monsters coming out of a portal are two instances I hadn't thought of in relation to this script. Thank you for all this work!
Can this Teleport to a new map or is it only internal map sections?