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

ChatSetAttr's `modbattr` throws an error in the log but otherwise seems to be working

1596484474

Edited 1596484673
Howdy, I'm working through an API tutorial &nbsp;that uses `modbattr` from ChatSetAttr&nbsp;to reduce the `lvln_slots_expended` attribute by 1. My code, which AFAIK is the same as the tutorial, and that tutorial is very recent: <a href="https://gist.github.com/eugenehiggins/b2990f6d3e8176418dba697c1a048014" rel="nofollow">https://gist.github.com/eugenehiggins/b2990f6d3e8176418dba697c1a048014</a> The error I'm getting: "ERROR: Did not specify an attribute name when referencing attribute using @{[the correct charID]}" "Error at eval (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:158:1), &lt;anonymous&gt;:575:11) at String.replace (&lt;anonymous&gt;) at Object.d20.textchat.doChatInput (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:158:1), &lt;anonymous&gt;:549:29) at sendChat (/home/node/d20-api-server/api.js:1815:16) at apiscript.js:17:13 at eval (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:154:1), &lt;anonymous&gt;:65:16) at Object.publish (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:154:1), &lt;anonymous&gt;:70:8) at /home/node/d20-api-server/api.js:1661: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)" The weird thing is that the attribute is being correctly reduced by one, so I don't know why the log is throwing this error. I logged out the attribute name it's trying to change and the string is interpolated correctly. Is it best practice to just ignore errors when things are working? Or is this not working as well as I think it is? Thanks, Gene
1596484840
The Aaron
Roll20 Production Team
API Scripter
It might not be ChatSetAttr.&nbsp; The call stack above doesn't look like it is.&nbsp; You could try disabling other scripts and see if it goes away?
There are only two scripts enabled, as this is my first crack at roll20's API: my customSpellbook, and ChatSetAttr. Are you saying there are scripts enabled by default I should go in and disable? I'm not seeing those. Thanks!
1596485661
GiGs
Pro
Sheet Author
API Scripter
No, there are no other scripts enabled. Its possible your custom spellbook script is the source of that error though. Try disabling it and see if you still get the error.
Sure, but when I disable my script nothing happens at all. I guess me saying "are there scripts enabled by default?" was my way of saying, "there can't be anything else, it's just my script and ChatSetAttr."&nbsp;
1596486324
GiGs
Pro
Sheet Author
API Scripter
Is your spellbook sending the modbattr commend? If so, your spellbook is definitely the source of the error.
Sorry, I never said I didn't think my spellbook was the source of the error, I'm pretty sure that's the source. I was just hoping to get someone to take a look at my gist above and tell me if you can see anything wrong with it, because I can't find anything. Thanks!
1596487126
Jakob
Sheet Author
API Scripter
This is a problem: --charid @{${charID}} Do you mean --charid ${charID} ?
1596487375

Edited 1596487599
Jakob said: This is a problem: --charid @{${charID}} Do you mean --charid ${charID} ? Yeah that was it! Thanks Jakob. I don't know the API well enough to know what the `@{}` is supposed to mean, this is my HelloWorld script.&nbsp; Thanks again! P.S I would like to point out that the script works either way, it's just that one throws an error in the log. And this being my first script I was wondering what technical debt I was setting myself up for.
1596488781
GiGs
Pro
Sheet Author
API Scripter
Gene Higgins said: Sorry, I never said I didn't think my spellbook was the source of the error, I'm pretty sure that's the source. I was just hoping to get someone to take a look at my gist above and tell me if you can see anything wrong with it, because I can't find anything. Thanks! Oops, I missed that part of your post.