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 .
×
We’re experiencing intermittent loading issues due to an external service provider. Please refresh if needed.
Create a free account

Snytax help for ChatSetAttr in ScriptCard or PowerCard

This one line is all I need help with. I am trying to call the ChatSetAttr Api from within ScriptCard to increment exhaustion_level by +1 --@setattr --exhaustion_level [[@{selected|exhaustion_level}+1]] thanks for your help 
1670526977
timmaugh
Forum Champion
API Scripter
Hey, Joel... Regardless of if that line is correct (and you can test by running the ChatSetAttr command on its own), you are going to run into the problem of not having a selected token when you call a mod script from another mod script (ScriptCards issuing a message for ChatSetAttr). This is because the Script Moderator (the receiver of bangsy messages) is like a player at the table, except it doesn't have any tokens selected. Since CSA is, I believe, set up to operate on the characters associated with the selected tokens, this will be a problem. You can get around it by using CSA syntax to tell it, manually, which character to operate on... or you can install SelectManager which will handle this for you in the background.
1670528241
David M.
Pro
API Scripter
Also, you seem to be missing a vertical pipe (   |   ) after your script trigger, and any double dashes normally used by the subordinate script should be converted to single underscores (   _   ). E.g., if a standard script call was !myScript --param1|val1 then in scriptcards this would generally be  --@myScript|_param1|val1  Of course, you may still run into selected token issues as Tim mentioned, possibly requiring a SelectManager call, something like --@forselected|myScript _param1|val1
1670540183

Edited 1670540217
Yeah I finally figured it out by doing: --@setattr|_charid @{selected|character_id} _exhaustion_level|[[@{exhaustion_level}+1]] This gives me the expected outcome I was looking for. Thanks for the assistance and replies