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 and multiple uses.

Can you use chatsetattr to augment/modify more than one attribute in the same macro? I'm trying to do this in powercards and I only get one ability change. The macro is designed to increase the target's strength with one !setattr and to set the nee modifier with a second !setattr based on the new strength value. I can get one or the other to populate but not both.
1599986194
GiGs
Pro
Sheet Author
API Scripter
The problem you are likely running into is roll20's order of operations. When you run a macro, befiore any parts of the macro are done, roll20 collects the values of all attributes mentioned in the entire macro. So, any mention of an attribute in the macro uses the score of that attribute as it was before the macro ran. so it's not possible to change an attribute, and then use that attribute's new bonus, in the same macro. The only way to solve this problem (without using a custom script) is to  calculate  what the attribute bonus should be with the change, and use that.
Ok. What would I add to this code to have Charisma set to be equal to $Enhance? And why doesn't the vfx work? This script is similar to the strength version but doesn't have any save conditionals. Game: Castles & Crusades &{template:default} {{name= [img](@{selected|token_image}) @{selected|token_name} Action}} !power {{ --bgcolor|#1c4587 --erowbg|F1F1D4 --orowbg|#b6d7a8 --name|Enhancement (Charisma) --tokenid|@{selected|token_image} --emote|**Anáil nathrach, ortha bháis is beatha, do chéal déanaimh** --leftsub|**R:** T **CT:** 1 **D:** @{selected|Spell-Strength} Hour(s) **C:** VSM --Effect:| **@{target|token_name}'s Charisma** is increased to [[ [$Enhance] @{target|Charisma} + ?{Type|Primary, 1d4+1 |Secondary, 1d2+1 } ]] --soundfx|_audio,play,nomenu|morgana --vfx_opt|@{selected|token_id} @{target|token_id} beam-frost  --?? $Enhance == 1 ?? api_setattr|_name @{target|token_name} _set _CharismaMod|-4 --?? $Enhance >= 2 AND $Enhance <= 3 ?? api_setattr|_name @{target|token_name} _set _CharismaMod|-3    --?? $Enhance >= 4 AND $Enhance <= 5 ?? api_setattr|_name @{target|token_name} _set _CharismaMod|-2   --?? $Enhance >= 6 AND $Enhance <= 8 ?? api_setattr|_name @{target|token_name} _set _CharismaMod|-1  --?? $Enhance >= 9 AND $Enhance <= 12 ?? api_setattr|_name @{target|character_name} _set _CharismaMod|0 --?? $Enhance >= 13 AND $Enhance <= 15 ?? api_setattr|_name @{target|token_name} _set _CharismaMod|1 --?? $Enhance >= 16 AND $Enhance <= 17 ?? api_setattr|_name @{target|token_name} _set _CharismaMod|2 --?? $Enhance >= 18 AND $Enhance <= 19 ?? api_setattr|_name @{target|token_name} _set _CharismaMod|3  --?? $Enhance >= 20 AND $Enhance <= 21 ?? api_setattr|_name @{target|token_name} _set _CharismaMod|4  --?? $Enhance >= 22 AND $Enhance <= 23 ?? api_setattr|_name @{target|token_name} _set _CharismaMod|5 --?? $Enhance >= 24 AND $Enhance <= 25 ?? api_setattr|_name @{target|token_name} _set _CharismaMod|6   --?? $Enhance >= 26 AND $Enhance <= 27 ?? api_setattr|_name @{target|token_name} _set _CharismaMod|7   --?? $Enhance == 28 ?? api_setattr|_name @{target|token_name} _set _CharismaMod|8 --?? $Enhance == 29 ?? api_setattr|_name @{target|token_name} _set _CharismaMod|9 --?? $Enhance == 30 ?? api_setattr|_name @{target|token_name} _set _CharismaMod|10 }}
1599994503
GiGs
Pro
Sheet Author
API Scripter
You'd be better off asking that questing in the dedicated power cards thread, where people will be familiar with power cards syntax.