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 here.
×
×
Cookie Preferences
We use Cookies to help personalize and improve Roll20. For more information on our use of non-essential Cookies, visit our Privacy Policy here.
Can anyone tell me how to tell this operation to round down? /?{Prim or 2nd|} There is something under this: floor(x) rounds x towards negative infinity. But I am not sure how to use that.
Hi Ziechael, Here it is: /me Attacks with @{Weapon_1} attack roll hits or misses by [[(@{Raw_BCS_1}+@{level}+@{Quality_1}+@{Special_Hit_Mod_1}-?{Armor Class|0}+?{Situational Modifier|0})/?{Prim=1 or 2nd=2|1}-1d20]] It adds several modifiers to the RAW BCS then subtracts AC adding situation modifiers. Then what happens is if you change the /?{Prim=1 or 2nd=2|1} to a "2" it halves the number. I want it to half that number rounding down. What it does now it gives fractional numbers. Example: BCS 14+2+1+0-10 would be 14 skill +2 level +1 quality weapon +0 special modifiers -Armor class +/- Situational modifers. So in this example: 14+2+1+0 = 17 - 8AC +/- 0 situational = 9 .... the last part of the macro if you place a 2 in the box it divides it by 2. So in this case it would be 4.5. Id like it to know to round down on those fractions. Thanks for the input in advance Ara
Try [[floor((@{Raw_BCS_1}+@{level}+@{Quality_1}+@{Special_Hit_Mod_1}-?{Armor Class|0}+?{Situational Modifier|0})/?{Prim=1 or 2nd=2|1})-1d20]] adding floor( just after the opening inline brackets, and ) just before the -1d20. (You could put it just before the ending brackets too.) You might change that Prim at the end from ?{Prim=1 or 2nd=2|1} to ?{Which Attack|Primary,1|Second,2} To give a drop down (change the labels as needed)
The main thing to remember if you use the player input query is that if they accidentally put 0 or leave it blank you may end up with a divide by 0 error. GiGs suggestion of a drop down query is much safer and limits the potential for player induced headaches ;)
Did I ever, took me a long time to figure out why the macro worked for a bit and then it failed after a few tries .... the 0 error. Will never forget again.