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

[Script] [D&D 5e OGL Sheet] ChatSetAttr macro to modify coin resulting in API Sandbox errors

I've recently been working on a macro so that my players can more easily add, subtract, transfer, and exchange coins. While everything seems to be working properly, I am receiving the following error code when any attribute is modified: "ReferenceError: update_weight is not defined" "ReferenceError: update_weight is not defined\n at Array.eval (dnd5e.js:1073:5)\n at self.trigger (evalmachine.<anonymous>:79:37)\n at messageHandler (evalmachine.<anonymous>:287:11)\n at process.<anonymous> (/home/node/d20-api-server/node_modules/tiny-worker/lib/worker.js:65:55)\n at emitTwo (events.js:106:13)\n at process.emit (events.js:194:7)\n at process.nextTick (internal/child_process.js:766:12)\n at _combinedTickCallback (internal/process/next_tick.js:73:7)\n at process._tickCallback (internal/process/next_tick.js:104:9)" The attribute totals for the coins seem to get accurately modified as well as the total weight the character is carrying. My concern is that this error code might result in additional issues I might otherwise be unaware. Is this something I should worry about? Is there anything that can be done via ChatSetAttr commands to avoid these errors? Is there anything that can be done to modify ChatSetAttr to avoid these errors?
1584972833
The Aaron
Roll20 Production Team
API Scripter
can you post the API command you're running which results in these errors?
!setattr --charid CHARACTERID --modb --cp|+?{How much cp?} --sp|+?{How much sp?} --ep|+?{How much ep?} --gp|+?{How much gp?} --pp|+?{How much pp?}
1584975180
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Not to completely sidestep the issue, but you might want to look into the Pursestrings script, available form the drop down , which does all this and more already.
keithcurtis said: Not to completely sidestep the issue, but you might want to look into the Pursestrings script, available form the drop down , which does all this and more already. I'll definitely look into it. I'm trying to avoid adding more scripts. I've got soooo many as it is. I already feel like I'm pushing my luck.
1584976421
The Aaron
Roll20 Production Team
API Scripter
Too many scripts you say....
1584976856
Kraynic
Pro
Sheet Author
Oh my...  And I feel like I am stretching things when I passed using a couple.  I think I may have broken into 3 rows (!) once dependencies are installed.  I guess I just don't trust all that api magic that far yet!  :p
1584977197
The Aaron
Roll20 Production Team
API Scripter
=D I've never run into a problem with having too many scripts, aside from being able to find them... 
PurseStrings yields a similar error. "ReferenceError: update_weight is not defined" "ReferenceError: update_weight is not defined\n at Array.eval (dnd5e.js:1073:5)\n at self.trigger (evalmachine.<anonymous>:79:37)\n at messageHandler (evalmachine.<anonymous>:287:11)\n at process.<anonymous> (/home/node/d20-api-server/node_modules/tiny-worker/lib/worker.js:65:55)\n at emitTwo (events.js:106:13)\n at process.emit (events.js:194:7)\n at process.nextTick (internal/child_process.js:766:12)\n at _combinedTickCallback (internal/process/next_tick.js:73:7)\n at process._tickCallback (internal/process/next_tick.js:104:9)"
1584995994
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Hmm. I'm not getting that, with either encumbrance system. Have you added an attribute or modified the character sheet?
1584996869
The Aaron
Roll20 Production Team
API Scripter
You know, I don't think that's an issue with either script, it looks like it's a problem with the DnD5e Character sheet. Just to test that, try setting your character sheet to none, then restarting the API and see if you get the error.
keithcurtis said: Hmm. I'm not getting that, with either encumbrance system. Have you added an attribute or modified the character sheet? I did in order to get ChatSetAttr working. Based on this, I just went through the following troubleshooting: deleted coin attributes on two existing character sheets created new character sheets without entering any thing in the coin fields setup coins via PurseStrings for new character sheets set new character sheets to use Simple Encumbrance set new character sheets to use Variant Encumbrance set new character sheets to use no Encumbrance All of these yield the same results and same error codes as previously listed. The scripts do  seem to work, but there are  error codes. So...
1584999287
The Aaron
Roll20 Production Team
API Scripter
After some digging, we determined that this is a problem in the Roll20 DnD5e Character Sheet.  I passed the bug on to one of the Developers with reproduction steps and they've created a ticket for it. On the bright side, the error doesn't actually cause any problems for the API.  It does however result in the weight not being correctly updated on the sheet.
1585001180
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Ah, these were error codes in the API log? I thought you were talking about the chat log. I didn't look in API.
Any update from the devs on the DnD5e Character Sheet? I've noticed similar errors using the Beyond Importer script with the charcater sheet: "ReferenceError: update_weight is not defined" "ReferenceError: update_weight is not defined\n at Array.eval (dnd5e.js:1223:5)\n at self.trigger (evalmachine.<anonymous>:79:37)\n at messageHandler (evalmachine.<anonymous>:287:11)\n at process.<anonymous> (/home/node/d20-api-server/node_modules/tiny-worker/lib/worker.js:65:55)\n at emitTwo (events.js:106:13)\n at process.emit (events.js:194:7)\n at process.nextTick (internal/child_process.js:766:12)\n at _combinedTickCallback (internal/process/next_tick.js:73:7)\n at process._tickCallback (internal/process/next_tick.js:104:9)" "ReferenceError: checkSourceForSheetworker is not defined" "ReferenceError: checkSourceForSheetworker is not defined\n at Array.eval (dnd5e.js:1185:9)\n at self.trigger (evalmachine.<anonymous>:79:37)\n at messageHandler (evalmachine.<anonymous>:287:11)\n at process.<anonymous> (/home/node/d20-api-server/node_modules/tiny-worker/lib/worker.js:65:55)\n at emitTwo (events.js:106:13)\n at process.emit (events.js:194:7)\n at process.nextTick (internal/child_process.js:766:12)\n at _combinedTickCallback (internal/process/next_tick.js:73:7)\n at process._tickCallback (internal/process/next_tick.js:104:9)" "ReferenceError: update_initiative is not defined" "ReferenceError: update_initiative is not defined\n at Array.eval (dnd5e.js:1023:34)\n at self.trigger (evalmachine.<anonymous>:79:37)\n at messageHandler (evalmachine.<anonymous>:287:11)\n at process.<anonymous> (/home/node/d20-api-server/node_modules/tiny-worker/lib/worker.js:65:55)\n at emitTwo (events.js:106:13)\n at process.emit (events.js:194:7)\n at process.nextTick (internal/child_process.js:766:12)\n at _combinedTickCallback (internal/process/next_tick.js:73:7)\n at process._tickCallback (internal/process/next_tick.js:104:9)" "ReferenceError: update_attacks is not defined" "ReferenceError: update_attacks is not defined\n at Array.eval (dnd5e.js:1030:9)\n at self.trigger (evalmachine.<anonymous>:79:37)\n at messageHandler (evalmachine.<anonymous>:287:11)\n at process.<anonymous> (/home/node/d20-api-server/node_modules/tiny-worker/lib/worker.js:65:55)\n at emitTwo (events.js:106:13)\n at process.emit (events.js:194:7)\n at process.nextTick (internal/child_process.js:766:12)\n at _combinedTickCallback (internal/process/next_tick.js:73:7)\n at process._tickCallback (internal/process/next_tick.js:104:9)"