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

Homebrew Macro help

I'm trying to get a macro for my home brew working. What I'm trying to do is have a modified roll [[1d20+@{modifiers}]] show the result and then calculate for me something based on the result. Specifically [[(1d20@{modifiers}-10)/2) which for this special attack tells me how big a certain bonus is.  The d20 results have to match or it's of no use to me. Do I need an API for this? If so, is there something already created that I can use? I'm a long time GM larning my way around Roll20. Have to say I'm loving it.
1590915333

Edited 1590915406
Ziechael
Forum Champion
Sheet Author
API Scripter
Recent emergent behaviour might be your salvation here, although you have to do it in reverse (ie show the original roll last): &{template:default} {{name=Roll}} {{Calculation=[[ ([[1d20]] + @{modifiers}-10)/2 ]]}} {{Original= d20 = $[[0]] }}
Thanks for the response. IT didn't work cut and pasted (cannot read property 'substring' of undefined) but when I typed it out it posted the same calculation for both. I got this working a bit better: &{template:default} {{name=roll}} {{Bonus=[[ floor([[1d20]]+@{Player 2|Longbow EXP}-10/2)]] }} {{Original= d20 = $[[0]]  }} It's calculated my bonus and  posting the original die roll. I couldn't get the "original" to include the modifier though, until this: &{template:default} {{name=roll}} {{Bonus=[[ floor([[1d20+@{Player 2|Longbow EXP}]]-10)/2]] }} {{Hit Roll= d20 = $[[0]]+@{Player 2|Longbow EXP}   }} which is doing everything I needed. Thank you so much!
I managed to get a query working inside it: /emas "Robin Hood"  Shoots Longbow  &{template:default} {{name=Shot}} {{Bonus=[[ floor(([[1d20-?{total penalties|0}+@{modifier} ]]-20)/3+3)]] }} {{Hit Roll = $[[0]]  }} {{Damage = [[1d8]] }}