
How do you use a variable in a macro? I want to use the EXACT dice roll multiple times over multiple lines.
Using a contrived example:
/me drinks a Potion of Healing for [[2d4+2]]
!token-mod {{
--set
bar1_value|[[{@{selected|bar1}+2d4+2, @{selected|bar1|Max}d1}kl1]]
--ids @{selected|token_id}
}}
The value will be different each roll. Now, I'm not looking for suggestions on how to improve the macro, that's missing the point. I'm looking to use the SAME ROLL more than once for whatever reason.
var roll = [[2d4+2]]
/me drinks a Potion of Healing for $roll
!token-mod {{
--set
bar1_value|[[{@{selected|bar1}+$roll, @{selected|bar1|Max}d1}kl1]]
--ids @{selected|token_id}
}}
In this non-working stub, I roll ONCE, and then apply that roll to both the screen and another script or macro. Even if I just wanted to print it twice (for whatever reason), all I want to do is use the SAME ROLL more than once. Today it's for the Potion of Healing, tomorrow it's for something else, the day after that it'll be for another thing. I'm not looking to rewrite every single function of the Roll20 interface with my own person scripts, I just want to use a variable so I can use a roll more than once.
My current hack is to create attributes on EVERY character called "temp_roll" and use that in all my equations, but that's so customized to my use-case with such a high setup cost it's not worth sharing for others to use.