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

Portals

So, I'm not a programmer, but function wise, I'd appreciate seeing a portal tool. It doesn't have to be fancy. I figure it can be a polygon line drawn on something like the dynamic lighting layer. When a character walks up to that line, instead of walking into a wall (when Restrict Movement is in effect), they're sent to the corresponding line. I like to put all the levels of a building on the same map. So it'd be really convenient to have my players be able to walk up stairs or go up an elevator without me having to drag and drop them potentially revealing parts of the map. Again, I don't know if this is feasible, but it'd be a nice tool. I also don't know if someone has coded a function like this that can be put in the API.
1425415055
The Aaron
Pro
API Scripter
Very feasible. There is a teleport script in the API forum that basically does this between pages, but it would be even easier on the same page (no token creation problems). You could almost do this with the TokenMod script, all but the automatic movement.
Very cool! I don't know the important parts of what you're saying (TokenMod script or the reference to the API that performs this action), but I'm happy it's not a difficult idea.
1425448920
The Aaron
Pro
API Scripter
I think this is the script: <a href="https://app.roll20.net/forum/post/193270/script-auto-teleporting-and-chat-based-teleporting#post-233925" rel="nofollow">https://app.roll20.net/forum/post/193270/script-auto-teleporting-and-chat-based-teleporting#post-233925</a>
Thanks for the link! I'll experiment with this in my backup game and show it to some of my players (who know more about code than I do) telling them this idea. I also realized that this was probably the wrong place to post this post and I should have put it in the Suggestions and Ideas forrum. Sorry Mods.
1425449175

Edited 1425449432
The Aaron
Roll20 Production Team
API Scripter
Nope, this is just fine for questions like this.. :) Though to be clear, I read this as more of an API question to begin with, so perhaps if you intended it as a feature request for the devs it should have been in suggestions.
1425463858
Ziechael
Forum Champion
Sheet Author
API Scripter
Also, in the meantime i'd suggest having your dynamic lighting setting to only update on drop... that way you can move token arounds the 'board' without revealing things until you put them down where you want them. That being said, i enjoy letting my players 'peek' round a wall while moving their token to reflect careful or stealthy movement... your call really :)
1425472435
Ziechael
Forum Champion
Sheet Author
API Scripter
Having looked at the teleporter script i think i'm going to use it in my sunken city... the end of which was always going to be a portal to the next part of the campaign anyway... now i can have fun with them zooming about within the city itself too! :) Damn those pesky netherese and their lazy ways of transport ;) My question however is thus... would it be possible to have the script modified to pick a random output 'portal' when using a loop of 9 for example (a fun way to split some members of the party up for that extra scary 'alone in the dark' feel. Rather than message the author direct (as is my usual) i thought i'd ask here just in case it was a minor tweak...
1425481661
The Aaron
Pro
API Scripter
You could definitely do that. Lines 121-128 pick the next location based on the item at the current square. Instead of the incremental change, you'd just randomly pick one of the valid letters and get that token. It would be easy to change it to always be random, a little more work to change it to be random for certain portals.
1425482905
Ziechael
Forum Champion
Sheet Author
API Scripter
Well then sir, your challenge would be to make it random for certain portals... ;) However in the meantime, i understand what that section is saying just not exactly what would need to be changed to make it 'random for all' at this stage (i promise i'm learning Java... just slowly)
1425483689
The Aaron
Pro
API Scripter
I'm sure you mean java SCRIPT !!!! =D This should be random if your portal names are prefaced with "R:", like "R:something 7A" or "R: oh noes 5B". I haven't tested it, but hey.. exercise for the developing java SCRIPT programmer... =D I bolded the added parts. /* ************ TELEPORTING SCRIPT ************************** * The intention of this script is to allow the DM to teleport * one or all characters to a location based on a token placed * on the DM layer of the map. * To activate the script, type "!Teleport " and add the name * of the teleport location (must not contrain spaces) and then * the name of the party member to teleport there. They must be * seperated by commas. If you want all to teleport, type all. * ie. !Teleport teleport01, all - teleports all players to teleport01 * * AUTOTELEPORTING: This feature allows you to place a token on * One square (for example stairs) and it will auto move a token * to the linked location and back again should you choose. * Linked locations need to be tokens placed on the GMLayer. * Naming conventions: * Two way doors: XXXXXXXX2A, XXXXXXXXX2B * Three way dooes: XXXXXXXX3A, XXXXXXXXX3B, XXXXXXXXX3C * (in the case of one way doors, dont create a 3C) * This system can handle up to 9 way doors (9I max). ****************************************************************/ var Teleporter = Teleporter || {}; Teleporter.AUTOTELEPORTER = true; //Set to true if you want teleports to be linked Teleporter.GMName = "DM (GM)"; //The display name of the GM Teleporter.Teleport = function (CharName, TargetName) { var LocX = 0; var LocY = 0; var OldLocX = obj.get("left"); var OldLocY = obj.get("top"); //find the target location var location = findObjs({ _pageid: Campaign().get("playerpageid"), _type: "graphic", layer: "gmlayer", //target location MUST be on GM layer name: TargetName, }); if (location.length == 0) return; //exit if invalid target location LocX = location[0].get("left"); LocY = location[0].get("top"); //if all are indicated, it lists all //finds all tokens with the name var targets = findObjs({ _pageid: Campaign().get("playerpageid"), _type: "graphic", }); //Move characters to target location _.each(targets, function(obj) { //Only player tokens if (CharName == "all") { if (obj.get("represents") != "") { log("Setting all"); obj.set("left", LocX + 1); obj.set("top", LocY); } } else { if (obj.get("name").indexOf(CharName) !== -1) { if (obj.get("represents") != "") { obj.set("left", LocX + 1); obj.set("top", LocY); } } } }); }; on("chat:message", function(msg) { var cmdName = "!Teleport "; if (msg.type == "api" && msg.content.indexOf(cmdName) !== -1 && Teleporter.GMName == msg.who) { var cleanedMsg = msg.content.replace(cmdName, ""); var commands = cleanedMsg.split(", "); var targetName = commands[0]; i = 1 while ( i &lt; commands.length ) { Teleporter.Teleport(commands[i], targetName) i = i + 1; } } }); on("change:graphic", function(obj) { if (obj.get("name").indexOf("Teleport") !== -1) return; //Do not teleport teleport pads!! if (Teleporter.AUTOTELEPORTER == false) return; //Exit if auto Teleport is disabled /* To use this system, you need to name two Teleportation locations the same * with only an A and B distinction. For instance Teleport01A and Teleport01B * will be linked together. When a token gets on one location, it will be * Teleported to the other automatically */ //Finds the current teleportation location var CurrName = ""; var location = findObjs({ _pageid: Campaign().get("playerpageid"), _type: "graphic", layer: "gmlayer", //location MUST be on GM layer left: obj.get("left"), top: obj.get("top"), }); if (location.length == 0) return; CurrName = location[0].get("name"); var Letters = new Array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L"); //Number of doors in the cycle (second to last character) var doorCount = CurrName.substr(CurrName.length - 2, 1); //Current Letter of the Door var currDoor = CurrName.substr(CurrName.length - 1, 1); //Finds the pair location and moves target to that location var i = 0; if( currName.match(/^R:/) ) { i = randomInteger(doorCount)-1; } else { i = Letters.indexOf(currDoor); if (i == doorCount - 1) { i = 0; } else { i = i + 1; } } NewName = CurrName.substr(0,CurrName.length - 2) + doorCount + Letters[i]; var NewX = 0; var NewY = 0; var newLocation = findObjs({ _pageid: Campaign().get("playerpageid"), _type: "graphic", layer: "gmlayer", //target location MUST be on GM layer name: NewName, }); _.each(newLocation, function(Loc){ //Get the new Location NewX = Loc.get("left"); NewY = Loc.get("top"); }); if (NewX == 0 ) return; obj.set("left", NewX); obj.set("top", NewY); }); on("chat:message", function(msg) { if (msg.content.indexOf("!AUTOTELEPORTER") !== -1 && Teleporter.GMName == msg.who) { if ( Teleporter.AUTOTELEPORTER == true) { sendChat("System", "Autoteleporting Disabled."); Teleporter.AUTOTELEPORTER = false; } else { sendChat("System", "Autoteleporting Enabled."); Teleporter.AUTOTELEPORTER = true; } } });
1425487391
Ziechael
Forum Champion
Sheet Author
API Scripter
I love Aaron baiting... learning Java is one of my goals for this year, i'm hoping to apply it to my work somehow to get them to pay for a course ;) I've ran the script but uh-oh: ReferenceError: currName is not defined at Sandbox.&lt;anonymous&gt; (evalmachine.&lt;anonymous&gt;:1665:9) at eval ( In theory though, if it worked ;), prefixing a token name with R: would make those particular portals randomised while leaving the non-prefixed ones incremental?? When you said 'a little more work to change it to be random for certain portals' you obviously meant just for mortals then?
1425487560
Pat S.
Forum Champion
Sheet Author
Since this has shifted to scripts and the discussion of getting one to work, I'm going to move it to the API forums. If Aaron thinks the mentor forum works better please move it back.
1425488557
The Aaron
Pro
API Scripter
API is fine. =D Yeah, sorry, the original author shifts naming conventions. Change: if( currName.match(/^R:/) ) { to if( CurrName.match(/^R:/) ) { So, all the portals that are in the random loop would need to be prefixed with R:. This is a bit of a quick hack. If you were REALLY doing this, you'd probably want some portals to be random and others to be specific, and possibly have portals with a chance at being random, etc.... That's the 'a little more work I was originally thinking of, the not really a hack" bit. =D
1425489181
Ziechael
Forum Champion
Sheet Author
API Scripter
Yey! I think i may have actually diagnosed that myself... and yet was way to scared to try it lol (i've only read the dedication of 'The Good Parts' so far ;) ). Works like a charm and to be fair, quick hack or not it does everything i need it to... i can mess with my players heads while still having reliable portals too. Sweet... thanks OP for bringing this back to my attention, first read about teleporting scripts before i was really up and running :) And the best bit... sometimes the portal teleports to itself which makes the portal appear not to work at all! Such fun to be had. I agree though, it could evolve into so much more... the original author suggests a way to hack one way portals but having them set out in the script would be good, as you say some random, some not, some that work as part of a chain but only go to specific ones etc etc. Way beyond me but potentially possible by referencing the bars for the tokens i would expect? *drifts off into delusions of grandeur at one day being able to write his own scripts and twist his campaign to his every whim...*
There are some free apps that will help you learn and practice, Ziechael. I don't do it often enough, but I've got a couple on my phone that have helped me understand a bit of what's going on in the script above. I'm sure if you look there are some afordable ones that are more indepth.
1425495269
The Aaron
Pro
API Scripter
Ziechael said: *drifts off into delusions of grandeur at one day being able to write his own scripts and twist his campaign to his every whim...* Me too! Some day....
1425497350

Edited 1425497702
its a good script, I used to use it to do floors in houses and move people between decks on a ship. Also, that was the first script that made me sad to hear the words 'good enough'. Don't suppose anyone could do a clean version of my suggestions there? I could add them, now, but they wouldn't be clean or tidy examples of script-work, just barely functional pieces of code, most likely. Plus, I tend to break things without realising what I did (I'm the bull in a china-shop kinda coder, it seems)
btw, I found the best way to manage this script is to have a bunch of pre-setup tokens all named and ready to go (I used to use a token storage page, but with folders now its easier to put them there for easy drag and drop from character sheets) so you just drag them into place on the GM layer and they just work. with a bit of extra coding, i'm sure someone could code it to uniquely name each token as its dragged onto the map, making setup a complete breeze. and in the interests of a handsfree GM experience I decided to update my suggestions here: something along the lines of two character sheets with tokens tied to them (I use a transparent PNG and tint each matched pair a different color so I can troubleshoot easily) called, say, "new teleport" and "teleport link". that way, you should be able to drag the token from "new teleport", have it name it correctly with a suitable and valid name, and then drag "Teleport Link" to the map, and have it automatically add itself to the end of the teleport sequence currently set by the last "new teleport" token placed down. a few commands added in to renumber sequences so that the linked teleport tokens could be reordered with a simple teleport order command, or to add a token to the middle of a sequence, automatically slipping it into the middle of the sequence and renumbering the numbers following it through a simple +1 to the sequential numbering past that point, as well as to add a token to a specific sequence after newer ones have been added via the "new teleport" method. adding an on/off switch to one of the tokens linked bars would make for easy setup of a network of teleporters, with on (or NAN) meaning that the teleporter token is active, and off (or anything else) meaning that it will not. Bar3 is my preferred location for an on/off switch, just for ease of use. Adding a method to read a list of possible qualifiers would be useful as well, perhaps a list of tags in one of the bubbles (bar1, for example) that would allow the script to apply such things as: Individual random teleports, allowing one teleport token amongst a sequence to be 'broken'; A Master teleport location that all other teleporters will return to before continuing on with the rest of the sequence; anything else that someone else could suggest or want this to be able to do... Another thing I would like to see is a conditional qualifier being able to be set up before a teleporter could be used. For example: A location that needs a key to access; An actual teleport circle that needs a command word to activate; An astral portal that can only activate if the players are tagged with an astral aspect of some kind (done in my games at least with a tokenmark). perhaps a simple permissions based command, where the GM can add tokens that will be teleported via ID? (Not sure about this one, as it is quite a broad set of possibilities, but in the interests of making it as comprehensive as possible I thought it only fair to at least include the suggestion of the possibility.) I'm sure I could think of more suggestions to be added, but I think this covers most cases of use that I, at least, can see being used by people. also, BIG thanks to Josh, who wrote the original on request so I could at least manage my players through the sailing ship that they adventured on, with its three decks and multiple methods of traversing them. (not to mention the rigging itself - man, it was a nightmare before this script)
1425502031
The Aaron
Roll20 Production Team
API Scripter
All very doable. (sounds like a good project for the burgeoning JAVA developer above.. =D )
1425504708

Edited 1425504808
**Looks up the list to Ziechael, beseechingly innocent eyes silently pleading**
1425505672
Ziechael
Forum Champion
Sheet Author
API Scripter
L...M...A...O considering i'm at the "Hello World" stage i wouldn't expect much until i can find some time to learn, learn, learn; (full time job, 3 small children, a house renovation and a D&D campaign to run) which is hard at the best of times. Even then if my coding develops like my macro's it is likely to be sloppy and bull in a china shopesque ;) Would love to turn around tomorrow and give you everything you want Michael... thanks for the pressure to learn quickly though Aaron! Ps. Would also like to give a huge shout out to Josh, I simply love this script as a concept and any evolution of it can only be a further testament to his effort in the first place :)
1425506221
The Aaron
Pro
API Scripter
=D I can see how that would suck up a bunch of your time. I agree, this is a nice idea, though I would probably take a completely different tack to implementing it. Should I pick up this mantle, I'll likely start over from scratch...
1425506739
Ziechael
Forum Champion
Sheet Author
API Scripter
I'll keep an eye out for it ;) &lt;-- the right eye since it's open to be exact.
I'd start from scratch too, if I knew how. I can code perhaps half of my suggestions myself, but not cleanly at all. usually better to have someone else work on a script and then let me help fiddle with it, I'ma good monkey that way
1425510624
Ziechael
Forum Champion
Sheet Author
API Scripter
Off topic but slightly related to the discussion: Just completed my first online course... i'm now a master of if/else, strings, numbers, booleans and setting variables, not to mention .length and .substring woohoo. Watch out Aaron, i'm coming to get your scripting crown!!
1425513493
The Aaron
Pro
API Scripter
Hehehehe. Competition is good for the consumer. :)