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

Adding an input to a die roll

September 26 (4 years ago)

Hi all,

I did some searching and did not find exactly what I was looking for and my macro-fu is not nearly as strong as many here so I thought I'd ask in hopes of someone knowing how to do this...


I want to have a macro that asks the user for a number and then perform a roll that equals the number entered minus 2d6.


I got the input part down, at least I think so, but am having trouble with the formula and output.  Thanks in advance!



September 26 (4 years ago)
Kraynic
Pro
Sheet Author
/r ?{Input Number?|0}-[[2d6]]

Change that 0 to whatever the minimum number is you expect to be entered. 

There are more ways to go about this, but it depends on whether you are doing a plain roll, using an inline roll, whether you are using a roll template and what roll templates are available in your game.  If you haven't been looking at the wiki, then you might want to give it a look for basic macro construction.

https://wiki.roll20.net/Macros

https://wiki.roll20.net/Dice_Reference

September 26 (4 years ago)
GiGs
Pro
Sheet Author
API Scripter

Can you post your partial macro, so we have a better idea of what you want? How do you want the output?

Here's a very simple way (that will give negative numbers sometimes):

/roll ?{Enter Number?|0}-2d6


September 26 (4 years ago)

&{template:default} {{name=Knockback}} 

?{Body done|0} {{Knockback={{[[2d6]]}}

September 26 (4 years ago)

Kraynic, that did it!  Thank you all for your quick assistance :)