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 .
×

Variables?

Scrolling around I read that I can't store any variable for later use, but I wonder Is it possible to write a player ability that uses a result from the same macro? Example &{template:default} {{name=Atk}} {{Fight=[[@{fight}]]}} {{Grit=[[@{Grit}]]}} Is it possible to add a line to this that sums the results obtained from the respective dice rolls? (I tried using {{Sum= @{fight}+@{grit}}}} but all I get is Sum= d20 + d20. My goal would be to get three lines, two showing the individual rolls and one showing the sum. Thank you.
1677766126

Edited 1677766319
Gauss
Forum Champion
Here you go:&nbsp; &amp;{template:default} {{name=Atk}} {{Fight=$[[0.computed]]}} {{Grit=$[[1.computed]]}} {{Sum=[[[[@{fight}]]+[[@{grit}]]]]}} Explanation:&nbsp; You can only apply math to rolls once, but you can call that roll and display it earlier (or later) in the template.&nbsp; So I moved the calculation to the Sum, then displayed the roll from @{fight} and @{grit} earlier in the template using $[[#.computed]] Here is the wiki on it:&nbsp; <a href="https://wiki.roll20.net/Reusing_Rolls" rel="nofollow">https://wiki.roll20.net/Reusing_Rolls</a>
1677768127
GiGs
Pro
Sheet Author
API Scripter
It might not be relevant to mention, but Reusing Rolls is not a documented feature, and might never have been meant to be exposed to users. That's why its hard to find documentation of it. It's still extremely useful :)