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

Macros and Rounding

Is there some command that will let me create a macro that will round a number?   I.E.  /roll d20+3/2 (round down)? This comes up for applications when I want to make use of attributes within the macros.  Like when the (3) represented above is the character level.  
I was looking at this and I tried the macro as you listed, that will only roll a d20 and add +3/2 fraction to the number, which basically gives you 1.5 of a number higher. I know this isnt the answer, but I wanted to let you know I was looking into this..
/r (1d20+3)/2 However, it won't round down.
I believe this is representing cases, like in D&D 4e, where something uses 1d20 + 1/2 a character's level. So a level three character with something such as this, would have a 1d20+1 because it would round down.
Couldn't you just make a "1/2 level" attribute?  Something like @HalfLvl?  Just as a solution for now. I don't think they plan on substantially increasing the amount of mathematical procedures allowed by the /roll command beyond what's built into Javascript.  It could probably easily be done through the API but that's kind of a cop-out response.  It just seems unlikely that they'll start adding in advanced mathematical functions like Int() or Mod().
knowing the decimals don't really exist would work as well. or if it is a compared roll: 34 is the next integer up from 33 and from 33.5
Good responses all.  Thanks! I ended up adding another attribute to settle the issue and fed that attribute manually.  
How about just doubling your test value and the roll result. /roll d20+3/2 > 17 might be the test you are after, so try /roll d20*2+3 > 34
Noteworthy: Round down is also known as Floor.  I have not looked into how /roll and the API interact, but in Javascript we do have Math.floor() which can be used to "round down".  If you can pipe your macro into the API, then you can definitely round down.
Awesome!  Thanks.