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

5th Edition OGL by Roll20 Companion not working

I'm getting this error could anyone help me?
1607695845
Pat
Pro
API Scripter
Not sure if it helps: I found another crash referencing this same error  here
The code is not touched in the last 3 years. It looks like the bug is in line 494:         atkammo = findObjs({type: 'attribute', characterid: character.id, name: "repeating_attack_" + atkid + "_ammo"}, {caseInsensitive: true})[0];         atkammo.set({current: atkammo.get("current") + "|" + ammoid}); But to know for sure i would need access to the character that is causing the error to manifest.
Martijn S. said: The code is not touched in the last 3 years. It looks like the bug is in line 494:         atkammo = findObjs({type: 'attribute', characterid: character.id, name: "repeating_attack_" + atkid + "_ammo"}, {caseInsensitive: true})[0];         atkammo.set({current: atkammo.get("current") + "|" + ammoid}); But to know for sure i would need access to the character that is causing the error to manifest. idk what character is causing it, its on all of them So if i use that code on line 494 instead of whats there, that show work?
1607708847

Edited 1607710975
Jordan C.
Pro
API Scripter
I think Pat was on the right track - do you have any characters that have identical names? Seems to be the problem in the previous thread and I was able to duplicate the error by creating an identically named character. Edit: Here's a crude function that can prevent that scenario from crashing the api const DupeCheck = (test) => { list = findObjs({name: test, type: "character"}, {caseInsensitive: true}) if (list != undefined){ if (list.length > 1){ log('Duplicate character names, process cancelled'); return true; } } }; Place DupeCheck(name) below Line 38, DupeCheck(charname) below Line 322, and DupCheck(Qualifier) below Line 368 I know it could be greatly improved by merging the function with the items on those lines but this seems to be an adequate quick fix. Since the script uses the msg contents it seems like the functions would have to be very different to handle based on which sheet was clicked on.
1607712855

Edited 1607728054
When using the script, the names of all characters should be unique. You can prevent the crash (but it does not correct the functionality)  by replacing line 494:         atkammo = findObjs({type: 'attribute', characterid: character.id, name: "repeating_attack_" + atkid + "_ammo"}, {caseInsensitive: true})[0];         atkammo.set({current: atkammo.get("current") + "|" + ammoid}); with          atkammo = findObjs({type: 'attribute', characterid: character.id, name: "repeating_attack_" + atkid + "_ammo"}, {caseInsensitive: true})[0];         if(atkammo) { atkammo.set({current: atkammo.get("current") + "|" + ammoid}); }   But as the script is looking up and changing  characters based on the name, the best thing is make sure all names of characters are unique.
I have created a new version for the "5th Edition OGL by Roll20 Companion" that reports duplicate characters in the API log and does not stop the API container. When this version is available in the One-Click API list is depended on when the pull request is handled.
Martijn S. said: I have created a new version for the "5th Edition OGL by Roll20 Companion" that reports duplicate characters in the API log and does not stop the API container. When this version is available in the One-Click API list is depended on when the pull request is handled. Thank you! I rely on that script fairly heavily, so I'm happy to hear a fix is imminent.
how do i add them to the script? if its from the library? Sorry im new to this
All my scripts stopped working - noticed this today "Roll20AM has had a significant update. The command syntax has changed and any currently existing macros will need to be updated" is the error I get...???
1607797432

Edited 1607797553
Jordan C.
Pro
API Scripter
Nicola H. said: how do i add them to the script? if its from the library? Sorry im new to this You won't be able to edit the one-click version - the update for it should show up next Tuesday I believe. If you need it now you can copy paste  this  into a new script in your game and disable the one-click. To do so you click  "New Script" click inside the black box, paste the script, title it something (like ' randomtitle. js') then save the script below the black console.
1607797496
Jordan C.
Pro
API Scripter
Von Viniga said: All my scripts stopped working - noticed this today "Roll20AM has had a significant update. The command syntax has changed and any currently existing macros will need to be updated" is the error I get...??? This seems to be unrelated to this particular thread, I would create a separate one describing your problem and the specified script.
OK, seems to have resolved itself after exiting and re-starting the game again, but I had the same result in the output as per the screenshot attached. The error "Roll20AM has had a significant update. The command syntax has changed and any currently existing macros will need to be updated" was in the actual console.
1607797720

Edited 1607797758
Jordan C. said: Nicola H. said: how do i add them to the script? if its from the library? Sorry im new to this You won't be able to edit the one-click version - the update for it should show up next Tuesday I believe. If you need it now you can copy paste  this  into a new script in your game and disable the one-click. To do so you click  "New Script" click inside the black box, paste the script, title it something (like ' randomtitle. js') then save the script below the black console. I had my game today, we manage to work around it so i will wait until tuesday to see if it gets fix thank you
1607798334
Jordan C.
Pro
API Scripter
Von Viniga said: OK, seems to have resolved itself after exiting and re-starting the game again, but I had the same result in the output as per the screenshot attached. The error "Roll20AM has had a significant update. The command syntax has changed and any currently existing macros will need to be updated" was in the actual console. Ah gotcha, the two would likely be unrelated. Typically  when the api crashes, it means the script wasn't able to catch and log the error so it would be very rare that you get an api crash/error and have the cause listed in the console. 
1607798448
Jordan C.
Pro
API Scripter
Nicola H. said: Jordan C. said: Nicola H. said: how do i add them to the script? if its from the library? Sorry im new to this You won't be able to edit the one-click version - the update for it should show up next Tuesday I believe. If you need it now you can copy paste  this  into a new script in your game and disable the one-click. To do so you click  "New Script" click inside the black box, paste the script, title it something (like ' randomtitle. js') then save the script below the black console. I had my game today, we manage to work around it so i will wait until tuesday to see if it gets fix thank you No problem! Just to clarify too, the fix still won't be able to process two identically named characters, it just prevents the API from crashing. You will still need to confirm that you do not have any characters that have the same name since we are assuming that is what is causing your particular error.
1607804837
Andreas J.
Forum Champion
Sheet Author
Translator
Martijn S. said: I have created a new version for the "5th Edition OGL by Roll20 Companion" that reports duplicate characters in the API log and does not stop the API container. When this version is available in the One-Click API list is depended on when the pull request is handled. Hope you updated the name to something like "New D&D 5E Companion", and ditch the outdated "5th Edition OGL" part of the name. The sheet used to be called that, but as it haven't had the name in a good while, talking about "the OGL sheet/API" will get more confusing as time goes on.  Ideally, Roll20 would update the existing script, but that might take a while...
1607815697

Edited 1607815763
As it is just a fix for a bug and neither new nor changed functionality, so i just pushed a change for the original code. As i am not the owner, it's not up to me to change names, do major changes or confuse things. 
Jordan C. said: Nicola H. said: Jordan C. said: Nicola H. said: how do i add them to the script? if its from the library? Sorry im new to this You won't be able to edit the one-click version - the update for it should show up next Tuesday I believe. If you need it now you can copy paste  this  into a new script in your game and disable the one-click. To do so you click  "New Script" click inside the black box, paste the script, title it something (like ' randomtitle. js') then save the script below the black console. I had my game today, we manage to work around it so i will wait until tuesday to see if it gets fix thank you No problem! Just to clarify too, the fix still won't be able to process two identically named characters, it just prevents the API from crashing. You will still need to confirm that you do not have any characters that have the same name since we are assuming that is what is causing your particular error. I did have some backup charachers with the same name (copy of player template) so i added numbers to them all
1607889762
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
It is bad practice to have identically named characters in a campaign for many reasons beyond the API. Two characters named "Bob" will give problematic results in any attribute or ability call.