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

SR-NextPass not working

When I apply SR-NextPass my API stops working and says there's an error. This script, once activated, subtracts 10 from initiative, removes those whose initiative goes below 0, and then re-sorts the list in descending order, which is vital for the smooth running of Shadowrun initiative. It is very encumbersome to manually subtract 10 from each individual person, then to have to re-sort the whole list manually since people can interrupt and take a -5 initiative. Can someone take a look at this and see why it is having an error?
1594852125
The Aaron
Roll20 Production Team
API Scripter
Can you post the error?
Your scripts are currently disabled due to an error that was detected. Please make appropriate changes to your scripts and click the "Save Script" button and we'll attempt to start running them again.  More info... For reference, the error message generated was:  SyntaxError: Unexpected end of JSON input SyntaxError: Unexpected end of JSON input at JSON.parse (<anonymous>) at apiscript.js:260:30 at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:154:1), <anonymous>:65:16) at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:154:1), <anonymous>:70:8) at /home/node/d20-api-server/api.js:1648: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 Zd.Ld.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:94:425)
1594859180
The Aaron
Roll20 Production Team
API Scripter
Try adding something to the turn order and see if it still crashes. 
OK, it's working now... not sure what the difference is, but as long as it works :)
1594898714
The Aaron
Roll20 Production Team
API Scripter
Ok. The turn order data is stored as a JSON encoded string. However, the default value is an empty string, which isn't valid JSON. The script isn't checking for that case (which usually only occurs in a brand new game). Adding a token to the Turn Order forces it's to become a valid JSON string and lets the script start up correctly.  I'll see if I can fix that in the script. 
1594899550
The Aaron
Roll20 Production Team
API Scripter
Sent a pull request with a fixed version:&nbsp; <a href="https://github.com/Roll20/roll20-api-scripts/pull/1038" rel="nofollow">https://github.com/Roll20/roll20-api-scripts/pull/1038</a> Should show up in the 1-clicks next week.
Thank you for your help! I was dreading having to manually subtract initiative from every token @_@
1594927731
The Aaron
Roll20 Production Team
API Scripter
You' likely be fine in that game from here on out since you've added something to the turn order.&nbsp; It should always stay valid JSON after this.&nbsp; But for posterity, it's fixed now in the 1.1 version. =D&nbsp; &nbsp;No problem!