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

ceil and floor in one macro

Perhaps one of you can help me with this problem: The result of my roll i.e. (2d10-12)/3 is either positive or negative. If it's positive, I want to round down (floor) the result and if it's negative, I want to round up (ceil) the result. Or in other words: my result should be rounded towards zero.  Everything I've tried, doesn't work. Any ideas for this formula?
1504136956
Andrew C
Marketplace Creator
Yeah you can't easily because macros don't treat die rolls as variables. So once you perform a calculation on it, you lose the original value.
1504143027
The Aaron
Pro
API Scripter
Do you care about the original sign?
1504225284

Edited 1504227983
I did some poking around and am not finding a math solution... but you could make a rollable table with the correct weights. -3: 3 -2: 12 -1: 21 0: 43 1: 15 2: 6 that should generate the intended output edit: helps when I use d10s not d9s when doing the math a b unrounded rounded 1 1 -3.33333333333 -3 1 2 -3.0 -3 1 3 -2.66666666667 -2 1 4 -2.33333333333 -2 1 5 -2.0 -2 1 6 -1.66666666667 -1 1 7 -1.33333333333 -1 1 8 -1.0 -1 1 9 -0.666666666667 0 1 10 -0.333333333333 0 2 1 -3.0 -3 2 2 -2.66666666667 -2 2 3 -2.33333333333 -2 2 4 -2.0 -2 2 5 -1.66666666667 -1 2 6 -1.33333333333 -1 2 7 -1.0 -1 2 8 -0.666666666667 0 2 9 -0.333333333333 0 2 10 0.0 0 3 1 -2.66666666667 -2 3 2 -2.33333333333 -2 3 3 -2.0 -2 3 4 -1.66666666667 -1 3 5 -1.33333333333 -1 3 6 -1.0 -1 3 7 -0.666666666667 0 3 8 -0.333333333333 0 3 9 0.0 0 3 10 0.333333333333 0 4 1 -2.33333333333 -2 4 2 -2.0 -2 4 3 -1.66666666667 -1 4 4 -1.33333333333 -1 4 5 -1.0 -1 4 6 -0.666666666667 0 4 7 -0.333333333333 0 4 8 0.0 0 4 9 0.333333333333 0 4 10 0.666666666667 0 5 1 -2.0 -2 5 2 -1.66666666667 -1 5 3 -1.33333333333 -1 5 4 -1.0 -1 5 5 -0.666666666667 0 5 6 -0.333333333333 0 5 7 0.0 0 5 8 0.333333333333 0 5 9 0.666666666667 0 5 10 1.0 1 6 1 -1.66666666667 -1 6 2 -1.33333333333 -1 6 3 -1.0 -1 6 4 -0.666666666667 0 6 5 -0.333333333333 0 6 6 0.0 0 6 7 0.333333333333 0 6 8 0.666666666667 0 6 9 1.0 1 6 10 1.33333333333 1 7 1 -1.33333333333 -1 7 2 -1.0 -1 7 3 -0.666666666667 0 7 4 -0.333333333333 0 7 5 0.0 0 7 6 0.333333333333 0 7 7 0.666666666667 0 7 8 1.0 1 7 9 1.33333333333 1 7 10 1.66666666667 1 8 1 -1.0 -1 8 2 -0.666666666667 0 8 3 -0.333333333333 0 8 4 0.0 0 8 5 0.333333333333 0 8 6 0.666666666667 0 8 7 1.0 1 8 8 1.33333333333 1 8 9 1.66666666667 1 8 10 2.0 2 9 1 -0.666666666667 0 9 2 -0.333333333333 0 9 3 0.0 0 9 4 0.333333333333 0 9 5 0.666666666667 0 9 6 1.0 1 9 7 1.33333333333 1 9 8 1.66666666667 1 9 9 2.0 2 9 10 2.33333333333 2 10 1 -0.333333333333 0 10 2 0.0 0 10 3 0.333333333333 0 10 4 0.666666666667 0 10 5 1.0 1 10 6 1.33333333333 1 10 7 1.66666666667 1 10 8 2.0 2 10 9 2.33333333333 2 10 10 2.66666666667 2