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] TokenLock crashing API

Receiving the following error any time I or a player try moving any graphic on the VTT when TokenLock is toggled ON: Using the latest version in the script library. Any help appreciated. Let me know if more information is required.
1566095198
The Aaron
Roll20 Production Team
API Scripter
Try adding a token to the turn order and see if it still crashes. 
The Aaron said: Try adding a token to the turn order and see if it still crashes.  No crash when a token is in the turn order. Is there something wrong with the setting that allows a player to move their token on their turn?
1566254995
The Aaron
Roll20 Production Team
API Scripter
No, it's a bug with the default state of the TurnOrder.&nbsp; TurnOrder on the Campaign object is a JSON string representing an object that contains the TurnOrder information.&nbsp; That string must be parsed by JSON.parse() to get the object.&nbsp; At one point, the version of Node.js that powers the API supported JSON('') returning Undefined, but sometime in the last 4 years, that changed to throwing an exception (the more correct response, honestly).&nbsp; However, this code is old enough that it assumes it will get a falsey value rather than just blowing up. =D I've fixed it and pushed 0.2.7.&nbsp; You can grab the latest here:&nbsp; <a href="https://github.com/shdwjk/Roll20API/blob/master/TokenLock/TokenLock.js" rel="nofollow">https://github.com/shdwjk/Roll20API/blob/master/TokenLock/TokenLock.js</a> I've sent a pull request so it should show up fixed in the 1-Click installs shortly.
Awesome, thanks for the fix! Glad I was able to help discover the issue :)
1566275523
The Aaron
Roll20 Production Team
API Scripter
=D