Dejan said: Ammo said: Will R. said: The script was working fine a week and a half ago, but it seems to no longer function for myself or any of my players. Keep getting this message: TypeError: Cannot read property 'forEach' of undefined
TypeError: Cannot read property 'forEach' of undefined
at runImport (apiscript.js:169:20)
at apiscript.js:139:21
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 /home/node/d20-api-server/api.js:1634: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 Zd.Ld.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:94:425) Pavel said: i am experiencing exactly the same problem as Will R. Could it be that dndbeyond changed their character data recently? Is it working for anyone else? Is this still going on? I am not seeing any such problems with the current code. Edit: This is the "5eOGL" version, not the "Shaped" version, right? Because the "Shaped" version is known to be broken. I don't believe there is anyone working on fixing it at the moment, either. One of my players who is a bard, his character made the script crash. Unfortunately I didn't keep a copy of the error message, but it was 'type' undefined inside the bonuses.forEach around line 986 of my version (there's a comment about XXX what are these?). I put in some checking in my version for all bonuses iterators to try and see if I can stop it from crashing. EDIT: Trying to get his character JSON, will PM to you Ammo EDIT2: Using your dev branch, at line 942, I edited as follows, testing with my player to see if it works. I'll make a PR if that's what you need: ```javascript bonuses.forEach((bonus) => { if (bonus && bonus.type) bonus_attributes[bonus.type + '_flat'] = bonus.value; //PATCH }); ``` Thanks for checking into that. This code is in fact new-ish and not included in the last release Robin did 0.3.9. Also, I agree that section is broken :) I am not sure about your fix, by inspection I think bonus.type is always just going to be the string 'bonus' at that location. You might need bonus.subType.replace( /-/ g , '_' ) instead . I will give it a whirl when I have a moment. PS: tracked on this feature, which is now classified a bug <a href="https://github.com/RobinKuiper/Roll20APIScripts/issues/33" rel="nofollow">https://github.com/RobinKuiper/Roll20APIScripts/issues/33</a>