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] Everything suddenly stopped working! Cron, Token-mod, Time Tracker

1481672555

Edited 1481672637
So last night I made a small redaction from Cron to stop it from spitting up a whole bunch of spam into the chat every time an event was set up. Worked great, everything was carrying on smoothly as normal until about an hour later, for seemingly no reason. Cron started to crash whenever I tried to put a !token-mod command through it. On top of that, my Time-Tracker script just stopped working altogether, and while that seems to be unrelated, the error did appear at the same as time the other one. So yeah, everything I seem to do doesn't fix the issue and I'm getting pretty frustrated, especially because these three scripts happen to be ones that I greatly rely on, and they're also ones I have found to be the most stable in my 1 year experience using the roll20 api. I don't know anything about script, and I definitely need some help on this. Cron: <a href="https://github.com/Roll20/roll20-api-scripts/tree/" rel="nofollow">https://github.com/Roll20/roll20-api-scripts/tree/</a>... Token-Mod:&nbsp; <a href="https://app.roll20.net/forum/post/4225825/script-u" rel="nofollow">https://app.roll20.net/forum/post/4225825/script-u</a>... Time-Tracker:&nbsp; <a href="https://app.roll20.net/forum/post/2691179/script-t" rel="nofollow">https://app.roll20.net/forum/post/2691179/script-t</a>... Cron Error Message: For reference, the error message generated was: TypeError: Cannot read property 'get' of undefined TypeError: Cannot read property 'get' of undefined at handleInput (apiscript.js:8879:36) at eval (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:144:34), &lt;anonymous&gt;:65:16) at Object.publish (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:144:34), &lt;anonymous&gt;:70:8) at /home/node/d20-api-server/api.js:1394: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 Ld.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:94:425) at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:111:461 Time-Tracker Error Message: For reference, the error message generated was: SyntaxError: Unexpected identifier
1481673777

Edited 1481674148
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
So, the Cron error is actually only tangentially related to Cron. Token-mod is actually what is crashing your sandbox. The error is generated in the handleInput function which only Token-mod has of those three. This is because Token-mod, like many scripts, uses the player identification info that is part of a message object to determine if the person sending the message is allowed to do anything, and if so, what. Cron is causing this error because of how API generated chat messages are handled; their playerid property is 'API' and, if I remember correctly, they don't have a who property. This causes errors when a script tries to find player using the playerid property of the msg because when it goes to use that player object, it is undefined, which then throws the error you are seeing. I'd recommend asking Aaron to either release an update to Token-mod that accounts for API messages, or see if he'll write you a custom modification of it that does the same. As for the Time-Tracker Error Message; do you get this on startup or after entering a command? I usually get this from a command that causes the script to attempt to parse some text as JSON if I've incorrectly formatted/entered the JSON text. EDIT: I partially take it back, it probably isn't actually one of those three that is causing the crash. What other scripts do you have installed? The problem is as I described above (I'm almost sure) in a Something.get('something'); command, but Token-mod's handleInput function doesn't have any .get's.
Hey thanks for the advice and clearing up why exactly I am receiving the error--I was afraid this was gonna be something that might've been hard to solve! I will send a message to Aaron about it and see if he can clear this mess up for me haha. As for Time Tracker, I get the error as soon as I spin up a new sandbox with it enabled. Was working fine before, and I re-copied the script from GitHub--still no dice, gives me the same error.&nbsp;
1481675489

Edited 1481675531
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
ok, try adding a semi-colon at the very beginning of the script, as a new line right at the top of the script. This happens sometimes when a script you have installed doesn't properly end itself with a semi-colon. This could have been caused by something changing the order of how your scripts are loaded since they don't always load in the same order. EDIT: And also, I'm pretty sure it isn't Token-mod causing the issue as explained in my edit above, what other scripts do you have installed?
Well, after you said that, I began disabling each my scripts one by one, and you know what happened? Of all things, !Torch was the one that, once disabled, made the api not crash on load up, and now everything seems to be working properly. I guess I don't necessarily need !Torch, but if it can be fixed, that would be very helpful.&nbsp; As for time tracker, I added the semi-colon but I'm still getting the same error message.
So no one is going to tell me how to fix time-tracker or torch? Is there any other script that I can use to toggle the global lighting on/off?
1481687185
vÍnce
Pro
Sheet Author
Charlie N. said: So no one is going to tell me how to fix time-tracker or torch? Is there any other script that I can use to toggle the global lighting on/off? The creator of Torch and a million other scripts on roll20 just had a newborn. &nbsp;I'm sure he'll chime in once he gets some sleep. ;-)
Got it. Thanks :D
1481866118
The Aaron
Pro
API Scripter
Hey! &nbsp;Sorry for the delay, as Vince pointed out, I've got a 15 day old here and doing all the things my wife normally does is EATING ALL MY TIME! (seriously, I don't pay her enough!). &nbsp;I'm catching up on my messages now. &nbsp;If you want to send me an invite to the game, I'd be happy to join and try and figure out the issue. &nbsp;PM me the join link and a description of how to cause the issue. &nbsp;In your error message: TypeError: Cannot read property 'get' of undefined TypeError: Cannot read property 'get' of undefined&nbsp; at handleInput (apiscript.js:8879:36)&nbsp; at eval ( eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:144:34), &lt;anonymous&gt;:65:16)&nbsp; at Object.publish (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:144:34), &lt;anonymous&gt;:70:8)&nbsp; at /home/node/d20-api-server/api.js:1394:12&nbsp; at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560&nbsp; at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147)&nbsp; at Kd (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:546)&nbsp; at Id.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:489)&nbsp; at Ld.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:94:425)&nbsp; at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:111:461 it does seem like a crash is happening in one of my scripts (I use the function name handleInput for message handling in pretty much all my scripts). &nbsp;Torch has the line: who=getObj('player',msg.playerid).get('_displayname'); which does make the assumption that msg.playerid contains a player id. &nbsp;In the case of an API script (like cron) issuing an api command, that would contain 'api' which would not return a player object from getObj() and would cause a crash like the one listed. &nbsp;I can certainly patch for that and make a release. &nbsp;If you want to make a patch and try to see if it corrects the issue, you could replace it with this line: who=(getObj('player',msg.playerid)||{get:function(){return 'API Script';}}).get('_displayname'); And see if it fixes it (It's line 192). Cheers and sorry for the delay!
1481912021

Edited 1481912132
Hey, don't worry about it man, my sister just had a baby a few months ago and I'm his babysitter 1 out of 7 days a week and that's more than enough for me! haha As for the issues I was having, the line that you gave me to replace seems to have done the trick--not just for torch but for every one of your scripts that weren't working for me, actually.&nbsp;So all I gotta say is wow--all that trouble I was having and you fixed all of it with a single line of code. I suppose you really are an arcane scriptomancer. :P Oh, and as for Time Tracker, I was impatient so I just made my own timer using cron, token-mod, and some maths. So I don't actually need it anymore!&nbsp;
1481919084
The Aaron
Pro
API Scripter
Cool beans! &nbsp;I'll have to update that logic across all my scripts and get it pushed up. =D