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

Macro (using ChatSetAttr & Powercards) to display and countdown Superiority Dice

I am building a set of Powercards macros for my player's characters, to display info and make rolls - they are loving them so far.  I wanted to incorporate a counter into some of them (Sorcerer Spell Points, Battlemaster Manuevers, Barbarian Rages, etc) but I am hitting a bit of a stumbling block. Any time the macro is called, it appears that the change to the relevant resource (D&D Roll20 OGL character sheet being used) is being captured after it is reported in the log - i.e. it is always displaying one count higher than it should.  Here is the macro: !setattr --silent --sel --mod --other_resource|-1 !power {{   --tokenid|@{selected|token_id}   --format|palos   --emote|//@{selected|token_name} turns aside his enemy's strike and lunges!//   --name|Riposte   --title|When a creature misses you with a melee attack, you can use your reaction and expend one superiority die to make a melee weapon attack against the creature. If you hit, you add the superiority die to the attack’s damage roll.   --Attack:|  [[ [$Atk1] 1d20 + @{selected|strength_mod} [STR] + @{selected|pb} [PROF] + 1 [Enchantment] ]] | [[ [$Atk2] 1d20 + @{selected|strength_mod} [STR] + @{selected|pb} [PROF] + 1 [Enchantment] ]] vs AC   --Damage:|[[ 1d8 [Longsword] + @{selected|strength_mod} [STR] + 1 [Enchantment] + 1d8 [Superiority] ]] Slashing | [[ 1d6 ]] Cold   --?? $Atk1.base == 20 OR $Atk2.base = 20 ?? Critical: |[[ 2d8 [Longsword] + @{selected|strength_mod} [STR] +1 [Enchantment] + 2d8 [Superiority] ]] Slashing | [[ 2d6 ]] Cold   --Superiority Dice Left:|@{selected|other_resource} }} For this character (as an example) he starts out with 5 Superiority Dice in his (other_resource) field.  The first time the macro runs, the "Superiority Dice Left" portion of the Powercard shows 5.  Then 4 on the next run, etc.  Seems that Powercards is capturing @{selected|other_resource} before ChatSetAttr is getting it decremented. Am I missing a step?  Or delusional in some other way? :D
1602443783

Edited 1602443800
GiGs
Pro
Sheet Author
API Scripter
This is just how things work on roll20. Any call to an attribute in a macro always uses the value of the attribute as it was just before the macro started. Since you know you are reducing the attribute by 1, you can account for this in the macro, by changing the last line to   --Superiority Dice Left:|[[@{selected|other_resource}-1]] I've never used Power Cards, but I assume that syntax will work.
That makes sense then.  Thanks!