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] Auto Teleporting and Chat Based Teleporting

I have created a script that does two things. First, you can type a command in chat to teleport any number of characters to a specified location by typing "!Teleport" and then the location, then the players. They must be separated by commas !&nbsp; For exampled "!Teleport tele01, Josh, Steve" will teleport Josh and Steve to tele01. You designate locations by placing tokens on the GMlayer and naming them as you see fit. It also has an auto teleporting feature. If you place a token on a specific location, it jumps them to another 'linked' location automatically. This is useful for stairs and portals. To enable it, first type "!AUTOTELEPORTER". It will tell you if you enabled or disabled it.&nbsp; To use this feature, place two token on the GMLayer. Name them anything you want, but end it in A or B. If a token moves onto it, it will jump it from A to B or back. &nbsp;NOTE: For larger creatures, the center of the token must be on the marker. NOTE: This also works with the Movement Tracker script I created. If you do not use that script, you will need to delete or comment out two sections marked with asterix for use with the Movement Tracker. Here is the code:&nbsp; <a href="https://gist.github.com/DarokinB/5750390" rel="nofollow">https://gist.github.com/DarokinB/5750390</a>
Please note, if you use my movement tracker, this will cause issues with it (if you move after the teleporting, then it will jump you back to your last pin). You will need to !Override_Maximum to allow them to continue to move. This is a temporary solution as I try to create a permanent one.&nbsp;
Wow. That was..... Quick. I am impressed and amazed. Also tired. It's 5 am here now, and I really should be sleeping, not testing scripts.... if only it wasn't so much fun
oh, and in THIS script you could surely use the method of adding the distance travelled by the token to its current speed and adding it before calculating distance moved? ( at least for the moment, or am I missing something in the other script that prevents that from working? Its 5am. I'm tired.)
I am working on that, but yes, I can. It will need to test if the Movement tracker is there and also if it is enabled (others may use this without using my movement tracker, so I have to accommodate). In the mean time, you can override maximums as I meantioned above.
suggestion? the auto teleporter currently creates an infinite loop, which can be solved by linking to a square next to the icon being teleported to - a small problem, but one that crashes the API. I suggest having the receiving end of the teleport actually be offset by one square. this will prevent looping. to determine direction of the offset, add another variable to the list. have it take direction from the value in bar1 (I would use compass points myself, ie, N, NE, E, SE, S, SW, W, and NW to figure direction of offset - easy to remember when setting up.) &nbsp;If no value is in bar1, then have it offset 1 square north by default. If you really wanted to get fancy, you could have bar2 determine the distance the token is offset as well, (definitely not necessary, but I would still use it just because I could - sometimes it would even fit the maps, I'm sure). perhaps bar3 to determine if the teleport is active or not at the time the character steps on it? (on/off would work there). oh, man, I just thought of adding a variable use command in there.&nbsp; Ok, so if bar3 reads "on", teleport is on and usable as many times as someone steps on it. If it reads "on#" where # is the intended amount of times you wish the teleporter to be used, then it counts down every time it shifts someone and eventually sets itself to off. if it reads "off" then it simply doesnt work until the DM turns in on again. Am I getting annoying yet?
God, I wish I could code in this language. I feel like a leech at the moment.&nbsp;
huh. well, fixed the loop problem line 127 &nbsp; &nbsp;obj.set("left", NewX+1); don't know why that works, but it fixes the teleport problem perfectly. still, all those other options would be good, though I don't know it they would work the way I imagine them working
Because the system checks to see if the current token matches the exact location of a teleportation token. Because you set it to 1 pixel to the right, it does not match and therefore does not teleport it. Odd that the infinate loop did not affect me. Perhaps because I am working on the Dev server? I don't know, but I am making the suggested change. While your suggestions are cool, I don't think I want to get that technical. This is good enough.&nbsp;
fair enough. And thank you for the groundwork. I will EVENTUALLY get around to my own code. and yes, this is plenty good enough. and yes, i know its offset, but on screen it teleports to the same square as the icon on the GM layer and without teleporting back.&nbsp;
Ok, I updated it so that it takes into account Movement Tracker. If you want to use it without the movement tracker code you will need to comment out the sections (there are two of them) marked for the Movement tracker.
Josh said: Because the system checks to see if the current token matches the exact location of a teleportation token. Because you set it to 1 pixel to the right, it does not match and therefore does not teleport it. Odd that the infinate loop did not affect me. Perhaps because I am working on the Dev server? I don't know, but I am making the suggested change. While your suggestions are cool, I don't think I want to get that technical. This is good enough.&nbsp; Another pretty easy fix would be to just store a variable in state like state.Josh.lastTeleportedFrom[objid] = [teleporterId] Then you could just check to make sure you aren't about to teleport back to the last place you were just at. Another possible improvement would be to take the obj.width and obj.height into account for the detection of the teleporter, so it doesn't have to be lined up exactly. I'm eventually planning to add utility functions for things like "objOnObj" or "objInObj" but haven't yet, sorry :-).&nbsp; All in all, a very cool idea! :-)
Thanks Riley, I appreciate :) The problem with the flag idea comes up in a scenario that happened last week: A party member ran up some stairs, saw a creature they didnt want to deal with, and ran back. In that scenario, the Flag becomes a problem because they use the same teleporter twice going back and forth intentionally on the same turn.&nbsp; I realized I broke my MovementTracker with this script and had to clean it up. I have updates posted for both this and Movement Tracker. &nbsp;I am trying to streamline the code to make is simpler and more efficient.
I like the idea of taking size into account. The only problem is that that causes the infinite loop situation Michael found. It would be very important in a scenario when a GM is not using a grid to snap to. What do people think about the idea of one way teleporters or three ways? Like A goes to B but not back, or A goes to B goes to C etc?
Nevermind! I did it! See the update. Names your locations (somename)2A, (somename)2B for two way doors, and (somename)3A, (somename)3B, (somename)3C for three way doors. Remove 3C in the loop to make a one way door! Ok, I took it a step further. You can have up to 9 doors in a loop.
1370896278
Konrad J.
Pro
API Scripter
The only other problem with teleporters is we don't have the ability to centre the players screen on a certain area of the map. &nbsp;So it could be hard for the player to find out where he just got teleported to. :)
All part of the fun ;) "Find your char before your next turn!"
1370953918
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Cool script! I think it might be a nice improvement though if all the teleported characters were spaced out instead of piled on top of each other.
Hi. I really would like to use the teleport script but it doesnt work for me. I guess I'm just missing something obvious but I have no idea how to use the API other than copy/paste your awesome scripts and follow the instructions to use it in my campaigns. But maybee you can help me out anyway. I did this: 1. I copy/pasted it into a new script. 2. I deleted both *** Handels Movementtracker *** parts. 3. I made two tokens on the GM layer and named them TeleA and TeleB. 4. I started the module and wrote !AUTOTELEPORTER in the chat field (which didn't do anything btw). 5. When i move a token to the TeleA Token nothing happens but Output Console shows me this: ReferenceError: MyTurn is not defined at Sandbox.&lt;anonymous&gt; (evalmachine.&lt;anonymous&gt;:101:9)&nbsp; at eval (
You missed one of the lines marked for movement tracker. I did not make it obvious enough. Instead, I created a GIST for non-movement trackers. Here is the link: Teleporter Without Movement Tracker
Also, you should name them Teleport2A, Teleport2B. You need a number to show how many locations are in the loop. 2 is a 2 way door, 3 is a three way loop, etc.
Thank you very much. It works now :D
I just want to say this is pretty amazing josh, it's one more step towards a (nearly) hands free GM experience. ;) Now if we're ever able to start moving players independently between pages, I just get giddy at the possibilities of using this to let players automatically and individually port between pages. :D