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

Math is hard!

Ok, I need a macro formula that I can use as an inline roll to give me from 50-150% of a queried number. So, in simplified format: [[ ?{Variable|90} * {50%-150%} ]] Any ideas on the best way to do this?
1428514408
Lithl
Pro
Sheet Author
API Scripter
[[?{Variable|90} * (d101 + 49) / 100]] Rolls a 101-sided die, adds 49 (1 will be 50, 101 will be 150), multiplies the result by the queried number, and divides the total by 100 (so the 50-150 will be a percentage instead of a number). You can wrap the whole thing in ceil, floor, or round to make the final result only whole numbers: [[floor(?{Variable|90} * (d101 + 49) / 100)]] [[ceil(?{Variable|90} * (d101 + 49) / 100)]] [[round(?{Variable|90} * (d101 + 49) / 100)]]
I knew someone would come through! What's the difference in output between ceil, floor, and round?
<a href="https://wiki.roll20.net/Dice_Reference" rel="nofollow">https://wiki.roll20.net/Dice_Reference</a> section on rounding. Rounding Rolls and Math Functions You may want to use rounding in your roll formulas to emulate mechanics such as "half a level, rounded down to the nearest level." Roll20 provides several functions to accomplish this: floor() which will always round the number down (e.g. 5.7 becomes 5), ceil() which will always round the number up (e.g. 5.1 becomes 6), and round() which will always round to the nearest whole number (e.g. 4.4 becomes 4 and 4.5 becomes 5). You can use these functions almost anywhere in your roll formulas (around a single math expression, groups of math expressions, or even the entire roll). For example:
Great! Thanks for the info.