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

Help with a macro

Can anyone tell me why this macro works: [[(10-((@{Physical-Dmg}/3)))d6>5]] while this one with the added "floor" in it doesn't: [[(10-(floor(@{Physical-Dmg}/3)))d6>5]] but this one with which is the same as the above minus the d6>5 also works: [[(10-(floor(@{Physical-Dmg}/3)))]]
1408117793
Sam M.
Pro
Sheet Author
Because dice get rolled before floor gets triggered. It's the order of operations macros use.
however due to how the system handles fractional dice there is a solution that you can use. since your macro is a value divided by 3 and you want to always round down you'll just add into it after the division "-0.66" fractional dice are always rounded up so if you want to round down you have to subtract out the largest fractional for any given number. So if your equation would have normally given you a result of 3d6 it would instead now give 2.33d6 which will roll as 3d6 still, and likewise if the result was normally 3.66d6 it would have rolled 4d6 but will now result as 3d6
1408127925
Lithl
Pro
Sheet Author
API Scripter
Chell said: fractional dice are always rounded up No, they are rounded to the nearest whole number (0.5 rounding to 1)
It works if I write it like this tough: /r [[(10-(floor(@{Physical-Dmg}/3)))]]d6>5
1408130519

Edited 1408130574
Brian said: Chell said: fractional dice are always rounded up No, they are rounded to the nearest whole number (0.5 rounding to 1) oops >.< sorry about that... so it should be -0.33 then [[(10-((@{Physical-Dmg}/3)-0.33))d6>5]]
My ultimate goal would be to have this macro in the "wound" attribute: [[(((@{Physical-Dmg}/3)-0.33))+(((@{Stun-Dmg}/3)-0.33))]] and then reference the "wound" attribute in another macro like so: [[(@{Agility}+@{Pistol}-@{wound})d6>5]] Im aware that inline rolls cannot be nested but can you guys see a work around for this. Essentially I would like the physical and stun damage wounds to be calculated in the wound attribute and then be able to use it within my other macros. I'm affraid it can only be done with api...
1408132614
Lithl
Pro
Sheet Author
API Scripter
Just take the square brackets out of the @{wound} attribute; there's no need to have the attribute be an inline roll.