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 .
×
Create a free account

[Script] Teleport - from scratch teleport token.

1615586154

Edited 1615586928
Mixing same and cross page links didn't occur to me until my last round of testing either, I thought it might help pinpoint where I'm running into problems. That wasn't the case in my original troubles, that pad had only cross-page links. If I had to summarize what I've found so far, I'd say it's two issues:  1- When a pad's Multi-link mode is changed via the Edit Pad button menu, regardless of selecting Random or Select, it wipes any extra links beyond the first from that pad. 2- When a pad's Multi-link mode is Select, and the destination pad is on a different page, player selecting from the popup of available links causes the API to crash (error shown above), and -all- the pads losing links after the first in their list. I tend to be wordy, I hope I made it concise enough to help and not confuse things further.
Not sure if I requested this before or not, but in case I didn't, a feature request for the next version of Teleport: the ability to let teleported tokens "bounce" to the nearest available square if there's a token on the pad already. Currently, if you teleport multiple tokens to a pad, they all end up stacked on top of each other, which is a bit of a pain. Would love it if I could teleport a bunch of tokens and have them neatly appear in unoccupied spaces around the pad. I don't know if this is feasible or not, but I figure there's no harm in asking.
1617831197

Edited 1617831866
Pat: This API is outstanding. I'm using it to prepare level 15 of Dungeon of the Mad Mage (if you know, then you know...), where I believe it will prove to be indispensable. I have a couple of feature suggestions, and a couple of questions. Question 1: When I type !teleport --help  into chat, nothing occurs. Did that command change, or am I entering it incorrectly? Question 2: I can't seem to get the SFX to work, but I can get the message to work. My players aren't in yet, so I'm going off what I can see as the GM using a test character... is it possible that the SFX are only meant to be visible to the character/user who is being teleported? Feature Suggestion 1: Could there be an edit option for messages to customize the messenger? Currently it's defaulted to "Environment" ... it sure would be nice to make that be "Halaster" or anything else I'd like... Feature Suggestion 2: Weighed random multilinking. Currently, multilinking creates even possibilities across all potential destinations. It would be great if there were a simple weighing system, say... 100 points of statistical weight that you could assign across the various linked destinations... so that I could specify a 50% chance of teleportation to Pad 5, a 25% chance to Pad 6, a 23% chance to Pad 7 and a 2% chance to Pad 8. Thank you so much for your excellent work. This is going to add so much more chaos and immersion (and thus fun) to our game. Kudos! (ETA: on Chrome, no janky plugins)
1617880423
Andreas J.
Forum Champion
Sheet Author
Translator
BTW did the cross-page teleport still have issues? I made a wiki page for the Script so it's easier to be found and has links here. Could be used for collecting tips &amp; tricks. When I'll get around to finally try this script out, gonna add some Gifs and screenshots to the wiki to illustrate use. <a href="https://wiki.roll20.net/Script:Teleport" rel="nofollow">https://wiki.roll20.net/Script:Teleport</a> &nbsp;
Howdy, Love this API, absolute literal game changer!, but I keep getting this error.&nbsp; "Nobody found in Limbo that matches on that page. Teleport cancelled." is there an way to manually put people in Limbo?
Phillip K. said: Howdy, Love this API, absolute literal game changer!, but I keep getting this error.&nbsp; "Nobody found in Limbo that matches on that page. Teleport cancelled." is there an way to manually put people in Limbo? As far as I know you have to have the tokens preloaded in the gm layer on that page to not get that message.
Thanks! That's all I need to do! Mark (GM) said: Phillip K. said: Howdy, Love this API, absolute literal game changer!, but I keep getting this error.&nbsp; "Nobody found in Limbo that matches on that page. Teleport cancelled." is there an way to manually put people in Limbo? As far as I know you have to have the tokens preloaded in the gm layer on that page to not get that message.
I have been testing the one-click Teleport API and it works great for cross-page, but I cannot make it work from one page to another. It crashes the API with the following error message: For reference, the error message generated was:&nbsp; TypeError: Cannot read property 'get' of undefined TypeError: Cannot read property 'get' of undefined at apiscript.js:10811:42 at Array.forEach (&lt;anonymous&gt;) at reconcileTargetPageId (apiscript.js:10810:25) at limboSwap (apiscript.js:10794:17) at teleportToken (apiscript.js:10835:23) at apiscript.js:10646:25 at Function.each (/home/node/d20-api-server/node_modules/underscore/underscore-node-f.cjs:1323:7) at teleportPadCheck (apiscript.js:10618:15) at autoTeleportCheck (apiscript.js:11220:21) at eval (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:154:1), &lt;anonymous&gt;:65:16) Any idea what I'm doing wrong?&nbsp; Is it maybe an interference with another script? I also have MapChange enabled, but nothing else that looks likely to conflict.
1620997043
timmaugh
Pro
API Scripter
Hey, Valerie... I don't use this script but I'm taking a look at the code to try to get you an answer as to why it's breaking or what might be the issue. The strange thing is your error (above) doesn't seem to match the one-click version. For instance, the only thing in the reconcileTargetPageId function that has a .get() associated with it is the Campaign() object, which is a Roll20 construct. It should never be "undefined". Another for instance: the error reports that the .get() is happening in a forEach() operation, except there is no .get() inside any of the three forEach() operations in the function. Last, the line error reports as 1 line after the reconcileTargetPageId declaration (10811 vs 10810), but there isn't a forEach on that line. There is only Zul a .get() attached to the Campaign object. Here are a few suggestions to try: 1) Can you send a screenshot of your installed scripts so we can see what else you have going on? 2) I would disable MapChange just to see if that makes a difference 3) The fact that your Campaign object seems to report undefined is troubling; can you try in a new game with the minimum amount of set up to try to replicate this error and see if it happens there, too? If that works, then you might have something wrong with your game and it would be a ticket to Roll20 for them to look at.
1621004157

Edited 1621004892
Pat
Pro
API Scripter
Valerie M. have you put the tokens to be teleported on the target page in the GM layer? It's necessary for cross-page teleport - it hides the token on the "leaving" page on the GM layer, and tries to find a token that points to the same player-owned character sheet on the "target" page.&nbsp; The other thing that might have happened - is if you cut and paste a target teleport token, or remove and "undo" removing a target teleport token, you can break the link. Doing either of the above resets the token id. There is supposed to be a safety in there on a destroy operation to remove "dead" token links from any other element lists - if you did not see that chat message I am not sure what would be causing your error.&nbsp;
Pat, yes I have another instance from the same character sheet on the GM layer in the destination map. I've tried it in both directions with freshly mutually linked teleport pads. timmaugh, I disabled MapChange and tried again. Here is my set of scripts: and here is the current error message on crash: For reference, the error message generated was:&nbsp; TypeError: Cannot read property 'get' of undefin TypeError: Cannot read property 'get' of undefined at apiscript.js:9508:42 at Array.forEach (&lt;anonymous&gt;) at reconcileTargetPageId (apiscript.js:9507:25) at limboSwap (apiscript.js:9497:17) at teleportToken (apiscript.js:9538:23) at apiscript.js:9349:25 at Function.each (/home/node/d20-api-server/node_modules/underscore/underscore-node-f.cjs:1323:7) at teleportPadCheck (apiscript.js:9321:15) at autoTeleportCheck (apiscript.js:9923:21) at eval (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:154:1), &lt;anonymous&gt;:65:16) Any ideas?
1621048391

Edited 1621048448
@Valerie, I got this error when trying cross-page teleport the first time. Disabled UDLPasswall and cross-page started working. Continues to work after re-enabling UDLPasswall. Try disabling then re-enabling that script. TypeError: Cannot read property 'get' of null at getTokenName (apiscript.js:750:26) at translate (apiscript.js:639:23) at commandSpeak (apiscript.js:568:25) at handleInput (apiscript.js:825: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:1663: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) at Kd (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:546)
1621048737
The Aaron
Roll20 Production Team
API Scripter
Are any of the tokens you are teleporting set to control by 'all' ?
@The Aaron, not when I tested, but I just tried teleporting such a token and got the exact same crash error as Valerie.
1621049202
The Aaron
Roll20 Production Team
API Scripter
I'm betting that's the issue.&nbsp; in the reconcileTargetPageId() function, this code: 1 2 3 4 5 players . forEach ( p =&gt; { if ( getObj ( "player" , p ). get ( "_online" )){ props [ p ] = targetpageid ; } }); would end up calling undefined on line 2 when it tries to getObj("player","all").&nbsp; The simple fix is to discard "all" as a possible player.&nbsp; The better fix is to detect "all" in the list of player ids and join the party together and move the ribbon to the new page. For now, if you remove "all" from the token/character and instead specify each player individually, it should prevent the crash.
1621066445
Pat
Pro
API Scripter
The Aaron said: I'm betting that's the issue.&nbsp; in the reconcileTargetPageId() function, this code: 1 2 3 4 5 players . forEach ( p =&gt; { if ( getObj ( "player" , p ). get ( "_online" )){ props [ p ] = targetpageid ; } }); would end up calling undefined on line 2 when it tries to getObj("player","all").&nbsp; The simple fix is to discard "all" as a possible player.&nbsp; The better fix is to detect "all" in the list of player ids and join the party together and move the ribbon to the new page. For now, if you remove "all" from the token/character and instead specify each player individually, it should prevent the crash. Might want to make it a configurable - set it to either move "none" on an all teleport or move the player ribbon on "all" - some groups may have a controllable by all in their party for some reason. A campaign level toggle and a configurable by teleport...&nbsp;
1621129315

Edited 1621129371
That was it! I removed "all players from control on both my test tokens, and it works beautifully.&nbsp; I did disable and re-enable UDLPasswall, but I don't think that had any effect. Thank you Persephone, Pat, and The Aaron -- this opens up so many possibilities!
Re-submitting a feature request for the next update to Teleport: the ability to have teleported tokens automatically pushed out into open squares if the landing pad square already contains a token. Currently, if you teleport a bunch of tokens, they all end up on top of each other at the destination, which is a pain if you have a large group (containing mounts, familiars, etc.). Would be lovely to teleport and have each token bounce to an unoccupied square around the destination pad.
1621452043
Pat
Pro
API Scripter
Jay R. said: Re-submitting a feature request for the next update to Teleport: the ability to have teleported tokens automatically pushed out into open squares if the landing pad square already contains a token. Currently, if you teleport a bunch of tokens, they all end up on top of each other at the destination, which is a pain if you have a large group (containing mounts, familiars, etc.). Would be lovely to teleport and have each token bounce to an unoccupied square around the destination pad. Understood. This is a thing that would be good, I tend to use hex instead of grid - it may be easier with grid, not sure - because a simple "find nearest empty" would be the baseline, but the risk is pushing somebody through a wall. So future may be raw "put in nearest if occupied" with a follow on being the wall calculation before full release.&nbsp;
Pat said: Jay R. said: Re-submitting a feature request for the next update to Teleport: the ability to have teleported tokens automatically pushed out into open squares if the landing pad square already contains a token. Currently, if you teleport a bunch of tokens, they all end up on top of each other at the destination, which is a pain if you have a large group (containing mounts, familiars, etc.). Would be lovely to teleport and have each token bounce to an unoccupied square around the destination pad. Understood. This is a thing that would be good, I tend to use hex instead of grid - it may be easier with grid, not sure - because a simple "find nearest empty" would be the baseline, but the risk is pushing somebody through a wall. So future may be raw "put in nearest if occupied" with a follow on being the wall calculation before full release.&nbsp; Thanks, Pat! Love the script, and I'm looking forward to what you do with it in future.
@Pat, is there any way the script could get the token markers on a token that teleports cross-page then apply them to the version of that token on the target page?
1622397702
Pat
Pro
API Scripter
Persephone said: @Pat, is there any way the script could get the token markers on a token that teleports cross-page then apply them to the version of that token on the target page? I don't know how well I could write that; I could probably write a configurable plug-in for tokenmod, since it likely could do this much better and with fewer bugs.&nbsp;
A TokenMod plug-in would be extremely helpful if you have the time!