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

RollStats bug

1443201840

Edited 1443201854
I previously posted an error in GitHub for the RollStats script. The author updated it in an attempt to resolve the error, and I updated my code. Things seemed to be going fine, but I'm getting another error: /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 ^ TypeError: Cannot read property 'length' of undefined at Object.RollStats.processRolls (evalmachine.<anonymous>:154:39) at RollStats.handleChatMessage (evalmachine.<anonymous>:485:13) at eval (
1443286060
The Aaron
Pro
API Scripter
(BTW, I'm not the author, I'm just trying to help. =D) That script seems to have quite a few problems.  I'll try to sort out what else it's doing.
1443286448
The Aaron
Pro
API Scripter
I did push another fix for that into the repo earlier.  See if you have the latest version or if you have this on line 40: if (!_.isArray(rolls) ){ return; }
Yup. That was the first thing I did yesterday. But I re-copied all code and tested again last night. The bug happened again.
1443287883
The Aaron
Pro
API Scripter
Do you know what you did to cause the error to occur?
I can't pinpoint it exactly. But it happens even when not explicitly using the !rollstats command. It just seems to break at random when people are chatting. So it would seem that maybe just chatting triggers it. I'm assuming it monitors every message for rolls. If there is a way to debug or trigger a note of some sort when this happens I'm happy to give it a shot or run a version with any additional debugging code. I'm not an expert, but I've tinkered around with basic programming.
Maybe a script that pings the GM to let it know the sandbox is running after every message in chat? It might get very noisy. But maybe it'll help identify where things break down. 
1443531495
The Aaron
Pro
API Scripter
I've had it running to do some testing and it does crash for me intermittently. I hate to completely rewrite someone else's script when they are still active in the community.  We should PM Manveti and see if he can take a look at it... (wanders away to do that...)
The problem is that some roll structures are coming in with either a roll node without a results section or a group node without a rolls section.  There's a new version up in my fork which will handle the malformed roll nodes more gracefully, as well as logging information about the node in question to the API console when it comes up. Incidentally, bugs filed on the official repo don't notify anyone who isn't a collaborator on the repo (essentially, Roll20 staff) unless you @mention them.  A while back, I set up a repo on which anyone who wanted to be a collaborator could be so we could have a reasonable bug/feature tracker for the scripting community.  There was essentially no interest, though, so I gave up.
1443582520
The Aaron
Pro
API Scripter
There is actually a way to get notifications for a repo you're not on (I set it up for me) but I don't recall how you do it off hand and can't seem to find it from my phone. 
It could be that you can't do it without also getting all activity notifications, which nobody wants.  Or maybe I just didn't look into it very hard because issues can't be assigned to non-collaborators, so it didn't seem appropriate to track script issues in a repo on which most script writers aren't collaborators.
Hey Manveti, Thanks for posting the update. I'll definitely run it this weekend and let you know how it goes. Also, I definitely agree with you about the issues with handling bugs. Posting on the forums for bugs seems kind of silly because it doesn't notify the author — it also doesn't provide any context as to who has been working on the projects and whatnot (I actually thought Aaron was the one behind this initially). So it is quite a mess, not only for reporting bugs but for communicating the issues to the right people. I think it is far more sensical to publish bugs on GitHub — it's not ideal, but it's more actionable and collaborative.
1443612479
The Aaron
Pro
API Scripter
You are correct Manveti, you do have to subscribe to all updates, which I do.  There aren't that many though, so it's not such a chore.  Still, I agree regarding it not being the ideal way of handling the bugs.  I have all my scripts in my own repo which I subtree into the Roll20 repo.  I've been adding bugs and feature requests in my own repo so as not to forget them, but I'm not a big fan of that system either. There is context for who contributed a particular project (that's how I knew to PM Manveti the link to this thread). It's in the package.json file that accompanies the script in the repo.  Many authors also add a header of comments which describe who created it and how they can be contacted.
Hey guys. Unfortunately, the bugs seem to be back. Here's what I got tonight with no other scripts enabled except the RolStats, IsGM, and Command line utilities script. All double checked to be latest version. /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 ^ TypeError: Cannot read property 'length' of undefined at Object.RollStats.processRolls (evalmachine.<anonymous>:47:39) at RollStats.handleChatMessage (evalmachine.<anonymous>:378:13) at eval (
Are you using the version I linked a couple of posts back?  If not, that should both avoid the referenced error and add some info to the log that would help track down what's different about roll objects now.  If you are using it, then there's something wrong with either the error reporting (e.g. the wrong error message is making it out) or the JavaScript implementation (e.g. undefined is being treated as truthy).
1444526789

Edited 1444526879
Oh gosh darn it! Okay, so I just remembered what happened. I was getting an error when I was using your script, but the error was blank. It was just an empty space. I was wondering if I had copied the scripts incorrectly or if something was wrong on my end, so I deleted the three scripts (isGM, the command line utility one, and the RollStats script. I copied them all from the Roll20 repo. I noted there was an update about three weeks ago from the RollStats script, so I figured it was pushed as an update to the main repo. I feel like an idiot. My apologies. Okay, so now that my brain is working again and remembering what's happening. I've just installed all the scripts correctly this time and made a note about your fork. This shouldn't happen again. In the meantime, do you have any advice for what I should do if I keep getting the error where it just says: "For reference, the error generated was: " (and literally nothing is beyond that). I'll keep a closer eye on this time, but I know it was definitely a problem.
1444530566

Edited 1444530655
I just installed everything (completely from scratch, and making sure to use the corrected script from you, manveti), and I got the error again that made me try to reinstall the scripts in the first place. No error message at all. Any idea why this might be? Worth noting that I had no interaction with the chat at all in the game. It's just crashing on its own.
1444563360
The Aaron
Pro
API Scripter
This empty error is a known bug in the API server right now. Just save the script to restart it.