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 issue

To my understanding in a macro ?{<variable name>|<default value>} sets a re-accessible variable for that macro resetting every time you reuse that macro. However, I found you can't store a dice rolled value only the rolling text. for example ------------------------------- ?{x|[[d20]]} ?{x} ?{x} ?{x} ?{x} -------------------------------- outputs 5 different random rolls when it should store 1 random roll printed 5 times. After all it is a variable. I need a way to turn a {1d20} into a variable holder so I can re reference my roll more than once in a macro. My use woud be . for example using ~{<variable>|<set to>} and ~{<variable>} to set it apart from --------------------------------- /em draws her +1, impact(+2), cold iron nodachi named Haru-no-Okina and strikes with a [[1d20cs>15+?{modifier|20}]], if she criticals (15-20x3) she tries to confirm with a [[1d20cs>15+?{modifier|20}]]. /em 's connected Haru-no-Okina's strike does [[2d8+13]] and [[1d6]] acid, if she criticals add [[4d8+26]] more. --------------------------------- could be changed to -------------------------------- /em draws her +1, impact(+2), cold iron nodachi named Haru-no-Okina and strikes with a [[{ ~{VAR | 1d20cs>15} +?{modifier|20}} ]], if she criticals (15-20x3) she tries to confirm with a [[1d20cs>15+?{modifier}]]. /em 's connected Haru-no-Okina's strike does [[{2d8+13{+{2d8+26}*{{{ ~{VAR} }>15}*2}}}]] and [[1d6]] acid. -------------------------------- As you can see the damage references the the first d20 roll and uses the pass/fail function as a 0/1 multiplier to the calculation of extra critical damage. My suggestion to fix/add functionality is to have the ?{<variable> |<value> } also include processing of math functions as part of the set value, or have a raw set variable option that can be set in a macro without a popup box and math functionality prior to setting the variable. Like below ---------------------------- ?{x=[[d20]]} ------->Variable set no popup box ------->Random roll rolls a 14 ?{x} -------> output 14 ?{y|[[d20]]} ------->Variable set with popup box ------->Random roll rolls a 3 ?{y} -------> output 3 ?{x} -------> output 14 /roll ?{x}d20+{?{x}*?{y}} ------->Sample use would be ------->Output would be a 56 hover would show: rolled{14}+(number{14}*rolled{3}) --------------------------- Thanx for reading this post...
1428702875
Stephen Koontz
Forum Champion
Marketplace Creator
Sheet Author
API Scripter
Compendium Curator
Hi Rand, Roll Queries I.E. ?{Example} are not a variable, it's not being saved. It's simply a way of prompting you to fill out part of the dice roll equation in the moment. Check out Order of Operations for more detail on how rolls/macros are processed. If you want to reuse the same prompt in several places inside the same macro you have to use the same prompt name. I.E. "/r ?{prompt}d6+?{prompt}d8". If you wanted to roll a random number of dice I.E. /r (1d4)d6 + (1d4)d8 you could do that by adding the 1d4 roll as your prompt in the form of an inline roll [[1d4]] since inline rolls are processed by the dice parcer earlier. However, it's not possible to nest inline rolls on the main server, yet. That said, there is no way to use the result of a roll as a variable to feed into other macros. So, you cannot say x=[[1d4]] xd6+xd8 The only way to do this is to use the Roll20 API which is a subscription level feature.