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 .
Advertisement Create a free account Compendium in Game, Join Today

Using Roll Table to Generate Mathematical Values

1614108153
Hey Folks! A bit stumped on the macro I'm attempting to work with, super new to them in general. Right now, the goal of my macro is to roll on a table (currently called "Opposed-Table"), which contains the numbers 2-12,each with varying weights. Then, once it calls this number, it wants to use that number in Roll20's "Target Number (Successes)" function to compare that number to a target, and return 1 Success (if greater) or 0 successes (if lesser), something that is built into the roll engine already - the example given on Roll20's Dice Reference resource is "/roll 3d6>3". When attempting to pass this value from the table into the Target Number function (using the command, "[[1t[Opposed-Table] ]]>3"), I receive an output similar to "8>3" (if the table call produced an 8, for example). To me, this indicates that Roll20 doesn't support passing mathematical values from Roll Tables to be used as a segment of other rolls. However, when using the command " [[1t[Opposed-Table] + 2]], Roll20 outputs a single number - when I mouse-over that number, it indicates that it successfully passed my Opposed-Table number, AND successfully added my flat quantity (2) to that number. So, this indicates that Roll20 DOES support passing those values as something you can mathematically manipulate. Further, per the Dice Reference resource, the Target Number function supports adding values to the given roll. So, is there some formatting issue that I'm missing that's causing it to work in one context, but not another? Is there something finicky causing the function to not recognize my table call as a malleable value, while basic math functions WILL recognize it that way? Any help is appreciated, thanks!
1614108519
The Aaron
Forum Champion
API Scripter
See if this works: [[1t[Opposed-Table] + 0 ]]>3 I suspect the addition causes a conversion of the value of the rollable table before evaluation by the >3, which is not happening without it.
1614108731
I'm afraid not - still returning "X>3" as my value.
1614109239
The Aaron
Forum Champion
API Scripter
hmm.  Maybe someone else in the community has a suggestion.  I'd try a few permutations like: [[ 1t[opposed-Table] + 0d0 ]]>3 [[ 1+1t[opposed-Table] - 1 ]]>3 etc.
1614109380
GiGs
Pro
Sheet Author
API Scripter
The problem is the < or > is finicky about what it accepts on the left side. When nothing else work, wrap in group roll brackets like /roll {1t[Opposed-Table]}>3 This approach will work with modifiers too, like /roll {1t[Opposed-Table]+2}>3
1614109667
GiGs' fix seemed to work! Thanks a bundle both, much appreciated!