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

[Help] Any way to test one-click before it is PR'd

1465896622
TheWhiteWolves
KS Backer
API Scripter
A question for the other scripters out there who are using one-click, do you know of a way to test the global config and one-click interaction before it is pulled into the main branch or the library. I am currently having an issue where a text option is coming through from the global config as true instead of "[GM]" which is entered on the front end, but without a system to at least simulate the one-click environment its becoming a pain to debug it.
1465902903
The Aaron
Pro
API Scripter
Post your script.json file here, we can help you spot the issue. There isn't a way to test that aspect beforehand. :/
1465903354
TheWhiteWolves
KS Backer
API Scripter
Here is a link to the script.json -&nbsp; <a href="https://github.com/TheWhiteWolves/MapChange/blob/master/script.json" rel="nofollow">https://github.com/TheWhiteWolves/MapChange/blob/master/script.json</a> And this is the script itself -&nbsp; <a href="https://github.com/TheWhiteWolves/MapChange/blob/master/MapChange.js" rel="nofollow">https://github.com/TheWhiteWolves/MapChange/blob/master/MapChange.js</a> This is what the script.json file looks like. { "name": "MapChange", "script": "MapChange.js", "version": "1.2", "description": "Provides a way for users to move between maps in a campaign without the GM needing to move them.\n\nFor full information on how to use the script, use the command '!mc help' in game.", "authors": "TheWhiteWolves", "roll20userid": "1043", "patreon": "", "useroptions": [{ "name": "Debug Mode", "type": "checkbox", "description": "Set to true to use built in debug statements", "value": "false" }, { "name": "GM Notification", "type": "checkbox", "description": "Set to false to turn off notifing the GM when a player moves.", "value": "true" }, { "name": "Marker", "type": "text", "default": "[GM]", "description": "The marker used to decide what is placed in the private map." }, { "name": "Inverted Marker", "type": "checkbox", "description": "When true this places the pages with name containing the marker into the public list.\nUse this if you want maps to be private by default instead of public by default.", "value": "false" }], "dependencies": [], "modifies": { "Campaign.playerpageid": "read,write", "Campaign.playerspecificpages": "read,write", "Page.name": "read", "Page._id": "read", "Page.archived": "read", "Player._displayname": "read", "Player._id": "read", "state.MapChange": "read,write" }, "conflicts": [], "previousversions": [1.0, 1.1] }
1465909896
Lithl
Pro
Sheet Author
API Scripter
In loadGlobalConfig, you have: 80 st.config.marker = gc['Marker'] === "[GM]"; In constructMaps, you have: 110 name = name.replace(state.MapChange.config.marker, "").trim(); 116 if (name.indexOf(state.MapChange.config.marker) &gt; -1) { 118 name = name.replace(state.MapChange.config.marker, "").trim(); So, every time you use the marker &nbsp;configuration option, you're treating it as a string. However, when you set up your configuration based on the global config options, you're setting it to a boolean value.
1465912336
TheWhiteWolves
KS Backer
API Scripter
Where is the facepalm emote when you need it.&nbsp;(-‸ლ) I was setting a default incase the user wiped the field and used the wrong bloody operator :| I think I'm probably going to re-write that section anyway, thanks for the help guys
1465914996
TheWhiteWolves
KS Backer
API Scripter
right looks like I might have found a way to simulate the globalconfig input, I have added in the following function and then called it first thing in the ready event. // TEST var testglobalconfig = function() { &nbsp; &nbsp; log("Global Config In:") &nbsp; &nbsp; log(globalconfig); &nbsp; &nbsp; log(globalconfig.mapchange); &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; globalconfig.mapchange = {}; &nbsp; &nbsp; globalconfig.mapchange['Debug Mode'] = true; &nbsp; &nbsp; globalconfig.mapchange['GM Notification'] = true; &nbsp; &nbsp; globalconfig.mapchange['Marker'] = "[GM]"; &nbsp; &nbsp; globalconfig.mapchange['Inverted Marker'] = true; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; globalconfig.mapchange.lastsaved = state.MapChange.gcUpdated + 1; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; log("Global Config Out:") &nbsp; &nbsp; log(globalconfig); &nbsp; &nbsp; log(globalconfig.mapchange); };