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

Floor function doesn't play nice with number of dice rolled

Trying to use the floor() function when calculating the number of dice rolled results in an error, presumably because it's already forced to round up. I'm guessing the same thing would happen if I tried to use the ceil() function or tried to calculate the number of sides of a dice. Subtracting .5 can act as a workaround for now.
1402631509
Lithl
Pro
Sheet Author
API Scripter
So long as you're using the /roll command, you could use inline rolls: /r [[floor(1.5)]]d6
Almost, but not quite. I ran into the problem while trying to calculate sneak attack dice based on my ninja level, which turns out very ugly if I'm not using an inline roll.
See <a href="https://wiki.roll20.net/Dice_Reference#Order_of_Op" rel="nofollow">https://wiki.roll20.net/Dice_Reference#Order_of_Op</a>... -- this is not a bug, it's just the way it is.
It's not a bug that it won't work? So what's the correct way to do this in an inline roll?
1402810018
Gauss
Forum Champion
Helmic , did Brian's roll command work for you?
It works, but it won't work as an inline roll, I can't nest inline rolls. Maybe there should be something dedicated to changing around the order of operations?
1402859471

Edited 1402859489
Gauss
Forum Champion
Correct, you cannot nest inline rolls, you will have to use /r as Brian indicated. As for changing the order of operations that would be something for the Devs. I am just here to help users use the tools available.