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 with API Crashing

Hello, I am getting rather deep into macro-making, and feel confident in my abilities to make interesting macros, solve problems, and google things to figure out what I'm doing wrong. However, when it comes to API, and actual programming, I feel like a tiny baby. I have no idea where to even begin (I've tried googling error codes to no avail). I've read the wiki about debugging ( <a href="https://wiki.roll20.net/API:Debugging" rel="nofollow">https://wiki.roll20.net/API:Debugging</a> ) and checked the forums. Here's an error code I've gotten: Error: Firebase.update failed: First argument contains NaN in property 'current' Error: Firebase.update failed: First argument contains NaN in property 'current' at Ba (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:9:186) at Ba (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:10:207) at Aa (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:8:462) at Ea (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:10:403) at J.update (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:146:318) at TrackedObj._doSave (/home/node/d20-api-server/api.js:864:27) at later (/home/node/d20-api-server/node_modules/underscore/underscore.js:888:31) at Timeout._onTimeout (/home/node/d20-api-server/node_modules/underscore/underscore.js:825:19) at listOnTimeout (internal/timers.js:549:17) at processTimers (internal/timers.js:492:7) Here is some further info: OS - iOS 10.14.6 Browser - Chrome (hardware acceleration on) Scripts: Monster Management Script.js, Roll20 Audio Master, TokenMod, splitArgs, ChatSetAttr, 5th Edition OGL by Roll20 Companion, MonsterHitDice, GroupInitiative. My API has crashed pretty much every session lately. The scripts I use frequently, in order of usage, is approximately as follows: TokenMod (setting markers, vision, and auras), ChatSetAttr (setting global damage/attack attributes), GroupInitiative (quickly adding and rolling monster initiative), MonsterHitDice (rolling monster HP) Please let me know if anyone has an idea of what I should do to prevent this problem. I understand errors happening, but I don't understand how anyone could have complicated API setups (which I have seen posts about more complicated ones) to the point that they crash constantly, and find it worth their pro subscription. I suppose I'm doing something wrong (perhaps), or those who make the best use of it are far more advanced than I am (I wish Roll20 had some of these features as defaults . . . such as remapping key commands, assigning markers with key commands, spells being able to toggle global mods, etc.) Thanks in advance!
1591407623
The Aaron
Roll20 Production Team
API Scripter
I've been hitting this quite a bit lately. I have a script to fix it, which I'll get to you when I'm not on my phone.&nbsp;
1591413787
The Aaron
Roll20 Production Team
API Scripter
Here: on('ready',()=&gt;{ findObjs({type:'graphic'}).forEach(g=&gt;{ let props = [ 'bar1_max', 'bar1_value', 'bar2_max', 'bar2_value', 'bar3_max', 'bar3_value']; props.forEach( p =&gt; { if(Number.isNaN(g.get(p))){ g.set(p,''); log(`NaN fixed: ${g.get('name')} : ${p}`); } }); }); }); Just install that script and it will fix the token with NaN in the bar.&nbsp; It will log the name of the token to the API Output Console, which can help you track down what might be causing it to happen.
Thank you!&nbsp; I've installed said script, and will report back if anything funky comes up. Do you have any further insight as to why this is a problem?
1591424128
The Aaron
Roll20 Production Team
API Scripter
It can happen when a script is assigning a value, but something about the math is wrong and results in NaN (Not a Number). It's a special value for Javascript so you can detect math errors. However it breaks Firebase's storage, which is where the crash comes from.&nbsp; You don't need to leave that script active, just disable it after starting the API up with it and letting it run once for a few minutes. It traverses all the graphics in the game and fixed them if they have a problem, but leaving it active will slow down your API startup.&nbsp;
Ok! Thanks. I don't know how to disable a script without removing it from the list of scripts in the API section of the campaign. Is there a way to toggle it, in case I need it again? Furthermore, is there a way to have the API spit out a report in chat when I receive a fatal error, that way I might have some idea of what caused it to shut down? Thanks!
1591490345
The Aaron
Roll20 Production Team
API Scripter
There's a "disable" button at the bottom when you select the script. It's next to the save and delete buttons.&nbsp; There isn't a way to have the api tell you when it's crashed, but I'm almost done with a script to address this in another way!
1591490531

Edited 1591491667
Go to the API Scripts page from the Game Launch page (outside your game) and click the name of the script you want to disable. There should be a gray button named Disable Script ; you may need to scroll down to see it in some cases. Click that and the script will still be in your library but it is not running. The script's name will be grayed out at the top of the API scripts page, showing it is disabled. When you want to start it up again, reverse the process and use the button named Enable Script .