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] First argument contains NaN

I'm working on my first script using the API and in testing it will eventually crash with this stack trace: /home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:1 orts, require, module, __filename, __dirname) { function g(a){throw a;}var j=v ^ Error: Firebase.update failed: First argument contains NaN in property 'rotation' at Error ( ) at Ba (/home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:9:186) at Ba (/home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:10:207) at Aa (/home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:8:462) at Ea (/home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:10:403) at H.J.update (/home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:146:318) at TrackedObj._doSave ( The top of the stack is outside my code so I'm having a tough time tracking down how to fix it. I added a try / catch where I access the rotation property of the object, but it looks like execution isn't getting to there. Any help on fixing issues like this? By the way my script is an event handler on "change:graphic" and it works well for a while until eventually this happens.
Just figured out my script was setting rotation to NaN under some scenario. Now I just need to figure out why :)
1447909979
Lithl
Pro
Sheet Author
API Scripter
Nobody can help you if we can't see your code. =)
Haha good point :) Never actually tracked down what the root cause was, but in the course of cleaning up the script the issue went away. Here's the script if you want to take a look at what I ended up with:&nbsp;<a href="https://app.roll20.net/forum/post/2617353/help-rotate-token-on-move" rel="nofollow">https://app.roll20.net/forum/post/2617353/help-rotate-token-on-move</a> . If you have any tips or optimizations to what I'm doing I'm very interested.