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

New help for ChatSetAttr in ScriptCard

1727176016

Edited 1727176184
Dink
Pro
not finding an answer to this,.. found a similar, but just plugging in different text isn't working.  Here is what I'm using to try to make a script for "Shield of Faith".  I'm trying to have it modify the AC of the targeted creature.  Script works as written without this line: --@modattr|_charid @{target|character_id}_ac|[[@{ac}+2]] This is only one version that i've tried, but can't find one that doesn't produce an error... tried this also with brackets on ac rather than curly ones... --@modattr|_charid @{target|character_id}_ac|[[@[ac]+2]] but this just comes up with a different error.
1727180241
timmaugh
Pro
API Scripter
I think you just need a space in your original command, before the _ac:  --@modattr|_charid @{target|character_id} _ac|[[@{ac}+2]] Should also note that this syntax must be on the character sheet because you reference the @{ac} attribute without providing a character reference. BTW, according to the ChatSetAttr documentation, you don't need the original value (to add to it). You shouldn't need the inline roll. Using !modattr (or the --mod argument with !setattr) will default to just adding your value to the attribute you supply. That means that this command should also work:  --@modattr|_charid @{target|character_id} _ac|2
Hey Dink, Another possible option for ScriptCards would be to use ScriptCards' object modification itself to modify the attribute. !script {{ --#targetToken|@{target|token_id} --!a:[*T:character_id]|ac:+=2 }} That use the targetToken setting which allows  attribute referencing shortcut [*T:  and then --!a to modify an attribute. In ScriptCards, the attribute can be added to with the += syntax. One benefit of having ScriptCards modify an attribute rather than shelling out to another mod is that ScriptCards can reference the modified variable after. For example: !script {{ --&ACIncrease|2 --#targetToken|@{target|token_id} --+[*T:t-name]|has an AC of [*T:ac] to start --!a:[*T:character_id]|ac:+=[&ACIncrease] --+[*T:t-name]|got their AC raised by [&ACIncrease]. Total Now [*T:ac] }} ScriptCards calls other mods, with --@, asynchronously so when they are used ScriptCards cannot reference modifications made in the same scriptcard. Just wanted to add another way of doing things. Let me know if you have any questions.
1727185700
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Another possibility is that if this is a Jumpgate game, there is currently an issue with the "target" keyword.
AWEsome help All around!!  Thanx MUCHLY!! to keithcurtis - NoSir, this isn't a Jumpgate game,... yet.  I'm usually leary of new system after i've put literraly hundreds of hours into a game,.. maybe i'll test it with a new one at some point and make the switch once most of the bugs are worked out, for now.. it's just reglar.. lol to timmaugh - Gonna try the suggestion and see how that works out for sure!   ** The space correcting didn't work and crashed with the repeating error, but the second revised version works well!   Thanx! to Joshua N. - Gonna try this suggestion as well,.. in fact, still learning here and didn't really realize could do this directly in ScriptCards, so this might be the way I go in the end.  I like the idea of limiting the use of an extra API when possible. ** The Scriptcards version works well also!  Will prolly be the end product as I can alter the wording in it, and the chat window display stays consistant with the characters other button actions. Thanx again all MUCHLY!!!