Advertisement Create a free account

Error when moving tokens

1560291874

Edited 1561078268
I get this error everytime a token moves. I have cleared everything browser wise. Your scripts are currently disabled due to an error that was detected. Please make appropriate changes to your scripts and click the "Save Script" button and we'll attempt to start running them again.  More info... For reference, the error message generated was:  TypeError: Cannot read property 'id' of undefined TypeError: Cannot read property 'id' of undefined at handleGraphicMovement (apiscript.js:7981:28) at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:151:1), <anonymous>:65:16) at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:151:1), <anonymous>:70:8) at TrackedObj.set (/home/node/d20-api-server/api.js:1020:14) at updateLocalCache (/home/node/d20-api-server/api.js:1318:18) at /home/node/d20-api-server/api.js:1502:11 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 Rd.Ld.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:94:425) Here are the scripts I have running Script Library G  5th Edition OGL by Roll20 Companion Limit HP Min Max G  TokenNameNumber G  GMSheet TokenAction G  TokenMod G  MonsterHitDice G  TokenLock G  Bump G  GroupCheck G  GroupInitiative RecursiveTable.js DeathTracker G  MapChange G  Message of the Day CombatTracker Concentration StatusInfo GM_Roll_Announcer ApplyDamage GetAPL G  Vector Math G  splitArgs G  HTML Builder G  Character Sheet Utils G  Check It Out AddPlayerCharacter Claim character It has been happening on and off for a couple of weeks. Any suggestion or ideas on how to fix?
1560293358
Seems to be with Combat Tracker
1560301136
The Aaron
Forum Champion
API Scripter
Changing line 941 to this: getCurrentTurn = () => { return (getTurnorder().shift())||{id:null}; }, will fix it.  The issue is that the turnorder can be empty, in which case it isn't returning a valid object with an id property.  This short defaults it to return an object (Null Object Pattern FTW!).
1560307742
Cool I will try that out. Thank you.
1560344464

Edited 1560344498
Still getting an error now it is this one.  ALso I am using the 2.7 one not the one click install. For reference, the error message generated was: TypeError: Cannot read property 'id' of undefined TypeError: Cannot read property 'id' of undefined     at handleGraphicMovement (apiscript.js:12439:25)     at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:151:1), <anonymous>:65:16)     at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:151:1), <anonymous>:70:8)     at TrackedObj.set (/home/node/d20-api-server/api.js:1020:14)     at updateLocalCache (/home/node/d20-api-server/api.js:1318:18)     at /home/node/d20-api-server/api.js:1502:11     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 Rd.Ld.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:94:425)
1560376316
It does seem to work fine when something is in the turn trackers. But it is now happening when a token is brought on to the table as well.
1560381379
The Aaron
Forum Champion
API Scripter
Hmm. I'll have to install it and give it a try. 
1560987593
any chance you have time to look at this?
1560997874
The Aaron
Forum Champion
API Scripter
Not yet, been on vacation on some really crappy internet. 
1561074986
If you are using Robin's stuff, go to here and download combattracker/statusinfo from here and see if your problem goes away.&nbsp; <a href="https://github.com/vicberg/Combattracker" rel="nofollow">https://github.com/vicberg/Combattracker</a> Use statusinfo to create your status icons if you are using any.&nbsp;&nbsp;
1561075116
same error happens with that one as well.
1561075943
Invite me to your game and once I join promote me to GM.&nbsp; You've got something wrong going on.&nbsp;&nbsp;
1561075953
PM me
1561075964
Don't post a game invite on the forums
1561076922

Edited 1561077483
Or if you don't want to PM me, then disable your 25 APIs and enable StatusInfo and CombatTracker ONLY!!! Then see if your problem goes away.&nbsp; If it does then one of the other 23 APIs is causing the issue.&nbsp; Rather than ask The Aaron, who is really nice but has to support 99.999% (and I forgot a few 9s) of roll20 pro users, who is also a Javascript Machine (but hey I'm still expecting that script that run through&nbsp; an entire campaign and gives XP automatically because I don't want to run the campaign and oh I need that script done yesterday), he's really busy with RL Work and on vacation right now!&nbsp; So, let me interceded.&nbsp; You've got WAY too many APIs going.&nbsp; They all don't auto-magically work together.&nbsp;&nbsp; So if after disabling EVERYTHING, if CT is still failing then you really must invite me to game so I can see what's happening.&nbsp; There's no real other way.&nbsp; If it starts working, then enable ONE AT A TIME, until the problem reappears.&nbsp; Then you know the culprit.&nbsp; Then ask yourself.&nbsp; Do you feel lucky?&nbsp; Do you?&nbsp; Consider which API is more important and drop the other.&nbsp;&nbsp;
1561079080
Toying around more, the combination of CT (Both) and TokenLock give the error. @The Aarron -&nbsp; No worries if you get around to it, if not thank you for your help. Hope you have a good vacation. @Victor - I am well aware of The Aaron suport and only asked as a follow up to his last response. Not that I expect him to take time out of his busy day, I was just asking. I had also already done as you suggested that was how I nearered it down to the CT in the 1st place. But I do appreciate the advice you offered as doing it once again I found the above statement.&nbsp; Seeing as your working on the updateds to the scripts now hopefully that information may be handly for others that might use the same two scripts.
1561079260

Edited 1561079288
So if CT is failing and there are MANY people using it without issue including me, and you've disabled all other scripts, then you've got something going on in your game.&nbsp; Don't know what.&nbsp; Invite me and then promote me so I have access to APIs and I'll find out whats going on.&nbsp;&nbsp;
1561079496
The two scripts CT and TokenLock together are creating the issue in multiply game I have created. It is not just CT or the one game.
1561090068

Edited 1561090101
Then invite me and let me figure this out or keep posting?&nbsp; You're choice.&nbsp;
1561508052
CT was definitely causing the very same API crash on my end, too. Or at least it was in conflict with another script. I disabled every script that I had running, started at ground level, and randomly began re-enabling the scripts. I got them all running, then shortly after that the API crash occurred once more. After disabling CT (and Status Info) I no longer have any issues.I haven't had the time to go through the elimination process again, so I cannot name for you which script could be in conflict with CT. Also, I have been following the thread (I may have been the OP, actually) so I got the newer code from Github, not the One-click install. I'm pulling for this to work. Its' been on the top of my RPG dream lists for 30 plus years lol.
1561514042
The Aaron
Forum Champion
API Scripter
Give this version a try:&nbsp; <a href="https://gist.github.com/shdwjk/8ae38733afca0b706f7ad8c05ff4c802" rel="nofollow">https://gist.github.com/shdwjk/8ae38733afca0b706f7ad8c05ff4c802</a> It definitely had a problem with custom turns, I couldn't get a crash specifically with dragging in new characters, so if that's persisting, PM me an invite and I'll see what I can do. Don't worry about bothering me, I'm busy all the time, but fixing scripts is what I enjoy most so don't take that away from me! (Though I appreciate the concern!) =D
1561520090
Thanks, I will definitely give it a go. I'm really intrigued by the capabilities that this script contains. As far as bothering you, that wasn't me that got called out on your account. I am a Patreon contributor of yours (at least until my card expired last month---gotta fix that ) so I have little to basically no reservations with cracking the whip and ushering you to a workspace to fix all of my petty issues :). In all seriousness, though, thanks again for the fix here, and for all the work you do on our behalf.
1561521289
The Aaron
Forum Champion
API Scripter
Hahaha! &nbsp;No worries.&nbsp;
1561688856
Hey Aaron, The changed you posted worked great for the game I did tonight. I had removed Tokenlock for Tuesdays game and it still gave the same error even with both scripts and fixes. So I tried the most recent post update with token lock after the game tonight and the same error happened, so not sure if there is something in TokenLock as well, but it seems to run better now.&nbsp; Thank you again for the update.
1561721395
The Aaron
Forum Champion
API Scripter
Hmm, I'll give it a try with TokenLock and see what I come up with.&nbsp;
1562270952

Edited 1562271032
The problem with CT right now is mostly around the next image (the green circle that highlights the next person up).&nbsp; Shut off that functionality.&nbsp; The custom turns logic looks suspect.&nbsp; @The Aaron, if you can get that fixed, I'll use your code for the new version of CT.&nbsp; &nbsp;And to be honest, I have no idea what that is even doing.&nbsp; It's something built into the turnorder and I don't know how people are using it.&nbsp;&nbsp;
1562271193
Also, there's another set of nasty errors that will arise if your initiative attribute is incorrectly set.&nbsp; I had one guy last night where CT was crashing on virtually everything until I set his initiative attribute correctly.&nbsp;&nbsp;