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] MapChange

1464707052

Edited 1466247586
TheWhiteWolves
KS Backer
API Scripter
Hello my fellow script users and makers, Today I wanted to introduce you all to a new script that I have been working on in my free time over the past few months, this script is MapChange, it provides both players and GM's easy and user friendly access to a set of controls for moving players between maps. The script comes built in with the ability to mark maps as private so that only the GM can move players to those maps (useful for upcoming campaign pages) and the inverse of that with the ability for maps to be public, which is the default setting. (useful for World Maps and Player Bases). I have built in some configurable options so that you can change certain behaviors of the script, the first being that you can invert the previously mentioned public/private map behavior so that all maps are private by default and have to be marked as public, another option is to change what the marker used to determine a private map is. Below I will try to detail a good portion of the information about the script for you but should you need help while in a game you can use the trusty help command to give you a fleshed out interactive help. Hope you all enjoy -- TheWhiteWolves ========================================================================================================= How to use the Script: Here is one of the easiest pieces to understand about this script. Type !mc menu into the chat and hit Enter. You have now unlocked a powerful ability to whisk yourself around the campaign pages (or other players if you are the GM). Now for an example, if you are a GM then you will see more options than a player. I have tried to make things player sensitive where possible so you players should only see what commands you only able to run. GM View: Player View: Now from here things are very simple, just click on the map you want to move to and woosh away you go, for you GM's there is some additional command that allow you to force a move on another player ( Other ) or the entire group ( All ). (this is how you would move a player or the group to a private map). And as some of you might be wondering there is a section in those pictures I have not said anything about, that would be the Utilities section, these are some extra commands I thought would be useful here so I made and included them. The first the the Rejoin command, this will take you back to the page that the bookmark is on and rejoin you with the party, for GM's you also have an Other to force another player to rejoin the bookmark. The last shared command on this page is the Help &nbsp;command, this will load up the interactive help menu for you to learn about the script (more on this later). And finally you GM's have a special Utility command, this is the Refresh command, this will allow you to re-construct the list of public and private maps to bring in any changes you have made, such as changes to map names, adding new maps or deleting old maps. That pretty much covers the basic on using the script, there is a more advanced way where you assemble the commands yourself but I would recommend you stick to the menu, I don't think I have left much out of the menu's abilities that you force you to need to make the commands yourself. Configuring Maps: By default all maps will be made public and available for any user to move to, there is a couple of options I have included in the script to modify this behaviour. The first way is to mark maps as private, to do this you include the marker in the maps name, by default this is [GM] (this is also configurable), so for example, I have a map called Baron Trevis' Keep &nbsp;I would add the marker to this name to make it [GM] Baron Trevis' Keep &nbsp;and this will then add that map to the private list instead of public. The second way to modify the behaviour is to invert the map markings, for this you set the Inverted Marker option to true, what this will do is place all maps into the private listing by default instead of the public listings, this then requires you to mark a map in the above way to make it public. (this is where changing the marker may be useful). The Help Menu: I have tried to make this menu as friendly as possible, with an interactive design that allows you to chose what to look at for more information and even example versions of the commands that has a button to launch it and show you what it does. When you goto the help menu either from the button on the menu or by typing !mc help into the chat and hitting enter, you will be given the below views. GM View: Player View: As before I have filtered the help for the players to only show what they are able to do, but even with that the functions are still the same, each command is given a name, description and Info button, clicking this button will take you to a detailed information page about it that will tell you what parameters it accepts, what those parameters want from the caller and the example. Menu Help: In the above example of the help documentation on the menu command you can see the pieces of information I previously mentioned, but what is also included at the bottom is a navigation bar, using this you can return to the help menu without having to retype the help command and you can also take the shortcut to the next piece of help information, this being the help on the move command. (there is also one for previous when on pages that have documentation before them). The last piece on the help menu is the General Information section, I have added this section for those who wish to know how to construct an api call to MapChange and how to use it's parameters along with some version information and a section for the credits, detailing the author of the script (me) and those who have helped me make this. Installing the Script: One-Click Install: 1. Goto the API Script section of your campaign. 2. On the Script Library Tab, Click the drop down box. 3. From the Maps & Drawings section choose MapChange. 4. Click Add Script. 5. When added, Click on the MapChange Tab in the scripts page and configure the User Customisation Options. Manual Install: 1. Goto my GitHub page and get the code -&nbsp; <a href="https://github.com/TheWhiteWolves/MapChange/blob/master/MapChange.js" rel="nofollow">https://github.com/TheWhiteWolves/MapChange/blob/master/MapChange.js</a> Bare in mind this will be the absolute latest version of my code until the API One-Click Install is ready (may contains bugs) 2. Goto the API Script section of your campaign and click on New Script. 3. Name your script (e.g. MapChange.js) and paste my code into the window. 4. Click Save Script and goto your Campaign. 5. Enjoy! Changelog: v1.3: Added RejoinAll command (Requested by Havoc ) Added ability to make maps hidden (default marker [Hide] ), this will give then a separate section in the menu like the archived maps. Fix Global Config issues for One-Click install (this should finally work). Added help entry on Configuring Maps. v1.2: Added handling of archived maps. (they now have their own section with a placeholder button on the menu) Added ability to block players from using commands. v1.1: Fix for when Array.prototype is extended causing invalid values in the key of a for in loop. v1.0: Release Hot Fix - Correct crash on startup on new campaigns.
Amazing! I must give it a try. :)
Well done!!
Absolutely fantastic. &nbsp; I will be testing this tonight!
1464724811
TheWhiteWolves
KS Backer
API Scripter
Thanks for the comments, just to let everyone know, if you downloaded the script before now please grab it again, there was a bug in it that was overlooked in a last minute change that only shows up in a campaign when you first install the script. You'll have to forgive me for that one, its the first time I have worked with using the state variable to have persistant data.
I just downloaded and installed the script into a game with no other scripts. When I start the game, I get a "TypeError: Cannot read property 'config' of undefined" error and the API shuts down. Is there some other script I need?
1464733598

Edited 1464733811
TheWhiteWolves
KS Backer
API Scripter
@Rabulias, Redownload the script, 2 hours ago I fixed that, that's what the message above yours is about. I've commited it to my github, so it should be there now.
Thanks. It's working now, though the version still says 1.00... Thanks for the hard work on the script. Looking forward to playing around with it now.
Hi, It's not working for me. Can you help me, please ? Here are the logs : {"debug":true,"gmNotify":true,"marker":"[GM]","invertedMarker":false} "Map Change Started" "Public:" {"TheSwamp":"-JVAag3zkMiC6rS9ecE8","TheRoad":"-JbwcJ_QFdyw2ILtYg2a","TheElvenCrypt":"-JeeWtPzunz6TH5wYC1T","TheForest":"-JeeWtbctN9oHqmDjvRP","TheTemple":"-JfgGicRUzB0BpxI0Slk","Tower":"-JhcapDZcp5VRhOhDJoM","InnSecondFloor":"-Jhcb8po47dY_cqGzRbL","InsideTower":"-Jhcb8qtuLhUJBaZe-JI","Castle ruins":"-Jhcfr_sZG3bpm_m3V2r","Thaig2":"-JiBjzH9MR3kVN_gmzJO","TowerTop":"-JkkeHZaE5qupg00_72a","Aeducan's-thaig":"-JmgeqaHB3O7aCcQWEoZ","Dungeon2":"-JmiRD2VPurs_0dXBY7M","Dungeon3":"-JmiSKXtif0YPGKv7AXQ","Slaver Hideout":"-Jo3qtmZGFEXtDvK60YL","TheShip":"-JpNPiNKd2qzHDA5vmDH","Inn":"-Jt1v3GRlVkAZ0YQNpjw","Holeintheground":"-Jt44ouA4ub49gszU5PS","Camp":"-Jw1AJMViPKsYwhm_Vzn","MASTER":"-JxdxuwrzK09fG1mr9O3","Plateau":"-JyI47F81C29vsT8nOwr","FinalBattle":"-JyINb-t2ZQoOqEv4Ml5","Trefonds":"-K0Ue36IrdPNw7T6bQ2N","Thecave":"-K8-y3LBzIWdzYyFmOAg","Auberge":"-K88jQn71Xmmd6lbQV0l","Donjon":"-K8IOhoYKR8QGsFcZ-RP","Temple":"-K8hywox6PGmtproJLu4","Clairval":"-K8hzgeC4ZzDjS_St8l7","Regionclairval":"-K8hzzn3sxtBvjSIcI5h","Ruinesdumoulinaeau":"-K8i-nAYaOekkrog31YX","Grottedesgobelins":"-K8i5Dk4RlQQXJ60vWcC","LaCarrriere":"-K8i5axUQe8b0ilD4CtZ","Osgild":"-KA1WoFGTCeBGFe3s8lC","Region":"-KBUJXQWqod-oWibXalF","FortBoueux":"-KBUKVC3e4yRM31BpHxr","Vireux":"-KBXJf4g-DAllBLVTQt7","LaFaille":"-KEHIs5MdU6hW2ckOn2i","Maisonenruine":"-KEHMqhvj_5UNLy1na2T","Sanctuaire1":"-KEHNN4ebsw6_hnktM5w","Sanctuaire2":"-KEHPYU7vQpww1BoZeO7","Monastir":"-KEHQCfOZLQ5oPrlLcmL","Grange":"-KEb4B8uA7D12ohhzxg4","Start":"7F73B956-71C3-4C5B-8C72-576EE4F15EA4"} "Private:" {} "Maps Constructed" "Map Change Ready" {"content":"Map Change Ready","playerid":"API","target":"gm","target_name":"GM","type":"whisper","who":"Map Change"} {"content":"!mc help","playerid":"-K7ylrEPLdCGNreQu3lU","type":"api","who":"GM"} TypeError: args .split is not a function TypeError: args .split is not a function at parseParameters (apiscript.js:7482:35) at handleInput (apiscript.js:7446:22) at eval (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api-dev.js:105:34), &lt;anonymous&gt;:65:16) at Object.publish (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api-dev.js:105:34), &lt;anonymous&gt;:70:8) at /home/node/d20-api-server/api-dev.js:1197: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) at Id.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:489) at Ld.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:94:425) at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:111:400
1464798445
TheWhiteWolves
KS Backer
API Scripter
Laurent said: [Stripped out to not clutter] Hey Laurent, First do you have any other scripts installed, If you do could you try running only with MapChange in and see if it still happens, alternatively also try using !mapchange help &nbsp;it could be that you have another script that also declares !mc as an identifier.
1464887068
TheWhiteWolves
KS Backer
API Scripter
Version 1.1 of the script has been released to my Github and a pull request for the Script Library created. The change for this verison is to fix and issue when Array.prototype is extended causing invalid values in the key of a for in loop, found in the error submitted by Laurent.
Looks good! One suggestion. Have an option to exclude archived maps from the listing. As a GM, I tend to archive maps that are not actively used. These are usually places the party has visited, in case they return later. Don't know if there is a way to tell, but if possible, that would make the script even better. Thanks for the work you have done!
1464892815
TheWhiteWolves
KS Backer
API Scripter
I'll take a look into it and see what I can come up with
1464993813
TheWhiteWolves
KS Backer
API Scripter
Version 1.2 of the script has been released to my Github and added to the pull request for the script library. In this version I have added to new main features: Added handling of archived maps. (they now have their own section with a placeholder button on the menu) Added ability to block players from using commands.
Very nice ! Thank you for your hard work..
how do i make maps public or private
1465287399

Edited 1465288516
TheWhiteWolves
KS Backer
API Scripter
You add the marker to the map name, by default that is [GM], this will make the map private, you can change what the marker is by either changing the user customisation options if using the one-click install or my changing the marker variable in the code. Also note that if you set the Inverted Marker option to true then all maps will be private by default and you will need to add the marker to make them public. EDIT: I have added a section in the OP regarding this and I will look to include a section in the help command in a future version.
1465292793

Edited 1465296461
Havoc
Sheet Author
API Scripter
The inverted doesn't seem to work. I have one map with [GM] marker and it still is in Private, like the rest of the maps. Turning off Debug Mode doesn't work. It will always set itself to true.
1465296444
TheWhiteWolves
KS Backer
API Scripter
are you using the one-click version or the standard code?
1465296635
Havoc
Sheet Author
API Scripter
One-click.
1465297134
TheWhiteWolves
KS Backer
API Scripter
right, its probably to do with the setting being pulled through from the global config, unfortunately I don't know how to test that area until it is released to one-click so it might take a couple version for me to get it right. I would suggest for now that you grab version 1.2 from my github and use that for now if you require that feature.
1465297468
Havoc
Sheet Author
API Scripter
The github version worked. How about you add an optional tag? I have a LOT of maps, so when I use the menu it stretches far. Why not have two tags? [Public] and [Private]? Show only those that have those tags, in their correct list, while those untagged would be invisible.
1465297722
TheWhiteWolves
KS Backer
API Scripter
I'll look into it, thanks :D atm if you archive maps then it will shorten your list and place them in separate area, this may help you for now.
1465297830
Havoc
Sheet Author
API Scripter
It would, but in archive I don't see the pictures I put on them, so having them on the page list helps me choose which picture to use during a scene.
1465297997
TheWhiteWolves
KS Backer
API Scripter
I see your point, I'll look at it for v1.3, I'll probably implement it as an additional tag by default and I'll have to think about the inverted behaviour.
1465299728
Havoc
Sheet Author
API Scripter
Just have two behaviors. One for two tags and the second for one tag. If the user specifies the optional tag, then it switches to two tag mode.&nbsp;
1465479599

Edited 1465484484
Dusky
KS Backer
I can't seem to get the inverted private mode to work. Using the Github 1.2 version. invertedMarker = true and the list behaves as default. [GM] maps are in private while unlabelled maps are in public. EDIT: The plot thickens. I have no idea why, but the inversion now works in the API. "{"debug":true,"gmNotify":true,"marker":"[GM]","invertedMarker":true}" However, when I copy pasted the script from that API to another game, the inversion doesn't work: "{"debug":true,"gmNotify":true,"marker":"[GM]","invertedMarker":false}" Didn't change a thing between the copy/paste, nor are either game running any other APIs.&nbsp; I have no idea what happened.
1465486710
TheWhiteWolves
KS Backer
API Scripter
Ahh I think I might have an idea of what happened, when it first loaded the script it inserted the defaults into the campaign state, once you reloaded it, it then took in your change, I'll add it to the list of things to look at, thanks for reporting it.
Know how to force it to adopt the change? Disable/enabling the script doesn't seem to have any effect, and I can't replicate whatever I did last time.
1465546735
TheWhiteWolves
KS Backer
API Scripter
atm I don't but I'll take a look at it next time I have a chance to work on the script.
This script is absolutely amazing! I had the pleasure of assisting TheWhiteWolves in early testing in three of my games. It's a great tool. One of the really nice things about this is it allows players to access maps that have been archived. So for instance, if you have a page set up for a world map or other type of information like charts (things too large for a handout), the players can access them without the GM.&nbsp; My newest campaign will be using this as a featured script.
1465856852
Havoc
Sheet Author
API Scripter
A new feature - Rejoin All to bookmark would be nice.
1465895156

Edited 1465895375
TheWhiteWolves
KS Backer
API Scripter
Havoc said: A new feature - Rejoin All to bookmark would be nice. Adding that to the list. Also to let everyone know, v1.2 should now be available on one-click install.
1466224525

Edited 1466224672
Gold
Forum Champion
Hello and thank you for this script, TheWhiteWolves ! I have been testing this MapChange API (from the One-Click Install). First one bit of confusion on my part, this took me a while to understand. &nbsp;Each time that you say "you can invert the previously mentioned public/private map behavior", I kept trying to find the Invert setting in the game, in the pink menu buttons. It's not there! After some study now I see, 4. Click Add Script. 5. When added, Click on the MapChange Tab and configure the User Customization Options. So I would just advise users to click the API name, in their API Scripts page, to get certain pre-Configuration options that are not found in-game in-chat. By the way, TheWhiteWolves, is there a reason you didn't just make Invert Public/Private Setting accessible in-chat from the pink buttons? I guess that is because you consider it would be a one-time setting and not to be touched after that? Ok, now down to the actual public/private/inverted problem I'm having currently with using MapChange, can you help me with making it Inverted and letting just a few pages to be accessible to the players? I did checkmark inverted marker, and changed the Marker text go GO- . Then I renamed several map pages into names like GO-WorldMap . Am I doing this right? Is it required to have a space after the Marker? Or is it required for the [Marker] to be inside brackets like that? So for me it's not working just in the aspect that all the Pages are still under Private. No pages that have GO- or otherwise are under Public. The public section is empty. Even after pressing Refresh pink-button, as well as actually reloading the game, logging in as Player and as GM, and re-saving the API script. &nbsp;Any ideas? (Otherwise, this script does work for me in my testing, in other respects, such as moving ALL Players to a certain page). Just having the one problem with making a map-menu for players which has only a few certain maps. Because I do not want to go through all my old pages and tag them [GM] on the non-inverted way, so I prefer to have the inverted default and tag them something like GO- if that is ok.
1466246725

Edited 1466247272
TheWhiteWolves
KS Backer
API Scripter
Gold said: [Removed] Right I'll try and answer everything in there, first I am thinking about allowing the configuration of certain options when in the game in a later version, I just need to think of a good way to implement it that works well with the one-click install. For the marker, you are doing it right, you don't need a space there, I only do it to separate it from the map name. The marker itself can be anything I only add brackets to it so that its abit more unique because if you were to set it to something like " Private " then it would pick up any map that had that in it even if you didn't mean it to be on the private list. e.g. you have two maps called " Private Kings Treasure Room " (one you want private) and " Kings Private Quarters " (one you don't want private) they would both be picked up for the private maps because they contain the marker. But as I said you can choose anything, your GO- should be sufficiently unique because its unlikely you will use that during the middle of a map name, also note that the marker is case sensitive so you need to match exactly what you put as the marker in your map name. Now onto the meat of the issue, the problem is not due to anything on your part, it is due to a mistake I made when I first set up the one-click install code, which is will be fixed in v1.3, (its hard to debug it as I can only test it once its released), for the moment you have a couple of options, you can either import v1.2 of the script from the script library, to do that you click Import &nbsp;instead of Add Script &nbsp;when installing it from the one-click library, this will give you the script in its code format. With that you can then just change the marker and invertedMarker variables at the top of the script from var marker = "[GM]"; var invertedMarker = false; to var marker = "GO-"; var invertedMarker = true; and change the version number from "1.2" to "1.2.1" to force a reload of the internal settings which will change it over to the configuration you desire. The next option would be to get the latest version of the code from my github (the part done v1.3 code) but this would still require the above changes or you can wait until v1.3 is released with the fix for one-click install in it (this may be a week or so though). I personally would recommend importing the code and making the change above until v1.3 is released and then switching back to the one-click version after the fix is released. If you need any help with this just PM me and I'll be glad to help you. EDIT: I have made the pull request for v1.3 now so you will be able to get it when they merge it in
1466247679
TheWhiteWolves
KS Backer
API Scripter
I ahve just released v1.3 of the script the changes are as follows: v1.3: Added RejoinAll command (Requested by Havoc ) Added ability to make maps hidden (default marker [Hide] ), this will give then a separate section in the menu like the archived maps. Fix Global Config issues for One-Click install (this should finally work). Added help entry on Configuring Maps. The pull request for the one-click install library has been created and is now just awaiting merging to be fully available for everyone's use.
1466483214
Gold
Forum Champion
Waiting patiently for the new version to come through the one-click. As far as I can tell it's still sitting at 1.2 as of now.
1466497307
TheWhiteWolves
KS Backer
API Scripter
Ye, unfortunately that part's not something I can control, the last PR took 11 days to be merged (opened on 2nd June, merged on 13th June) so it it stays around the same then it should be merged sometime this week or early next week.
1466624753
Lucian
Pro
API Scripter
Hey, One of the users of the 5eShapedCompanion script was having trouble which he thought was related to that script, but it turned out to be a problem with MapChange. A cursory glance at the script suggests that the lines: // Set to true to use built in debug statements var debug = state.MapChange.config.debug || false; // Set to false to turn off notifing the GM when a player moves. var gmNotify = state.MapChange.config.gmNotify || false; at the start of the script will fail if the state.MapChange object has not yet been initialised (which happens in the checkInstall function below). This was causing a fatal API error - you might need to change it to: var debug = (state.MapChange && state.MapChange.config && state.MapChange.config.debug) || false; or change your approach in some other way so that you don't need the state object to be configured at that point in the script. Cheers,
1466628120

Edited 1466628183
TheWhiteWolves
KS Backer
API Scripter
Cheers Lucian, thats the bugger I have been trying to sort today, didn't realise I'd left some debugging code in when I pushed the new version. EDIT: anyone who has v1.3 from github, please re-download to sort the above issue out.
1467406406
TheWhiteWolves
KS Backer
API Scripter
Just to let everyone know, v1.3 has been pulled into the one-click library so shoule now be available for full use. If anyone has issues then please let me know.
1467408290

Edited 1467409190
Gold
Forum Champion
TheWhiteWolves said: Just to let everyone know, v1.3 has been pulled into the one-click library so shoule now be available for full use. If anyone has issues then please let me know. One-click gave me the v1.3, that is the good news. Thank you for this script work and I wish it was working just-right for me from the update. I've checked that it is 1.3, checked my options configuration, clicked Save Script & Reloaded Game multiple times. The trouble is, whether I have "Inverted" checkmarked or not, either way it's the same result. The maps with the MARKER text (which I want to be my 5 Public maps) are always coming up Private, and the 33 maps I want to remain Private are all coming up as Public. Basically it looks like "Inverted" is not working for me, as I have only retitled the Marker text on about 5 maps which are the 5 that I want to be public, and right now those are the only 5 maps that keep coming up as Private. P.S. Also when I click Refresh there is no response or reporting in the chat, however, when I look in the API Output Console there is text saying Refresh Complete. It would be nice to get that confirmation in the chat as well.
1467413257
TheWhiteWolves
KS Backer
API Scripter
Gold said: [Removed for quote] Right, I'll take a look at it tomorrow, now that its on one-click I can test it myself aswell. As for the refresh map notification, have you got gm notifications turned off as it will only send things to the chat if it is on.
1467414262
Gold
Forum Champion
TheWhiteWolves said: Gold said: [Removed for quote] As for the refresh map notification, have you got gm notifications turned off as it will only send things to the chat if it is on. I have GM notifications checkmarked ON, Debug mode checkmarked OFF, Inverted checkmarked ON.
1467414559
TheWhiteWolves
KS Backer
API Scripter
mmm, strange must be another piece not carrying across properly, I'll add it to the list of stuff to look at
1469015562
Gold
Forum Champion
Any findings on that bug? Was it just me? Thank you for this.
1470472671
TheWhiteWolves
KS Backer
API Scripter
Gold said: Any findings on that bug? Was it just me? Thank you for this. I'm having a look into it but not had much ability to recently due to being very sick.