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

Variable Target Number Macro: Help Needed

Hi guys, fairly new to Roll 20 and having a little trouble getting a macro to work how I want - basically, I want to roll a spotting check, which is a straight d6 with a modifier of +1 if the unit doing the spotting is a recon unit. The result is a number > a variable target number, depending on a cover the target unit is in. So, without adding the recon modifier, this works as: EXAMPLE ONE &{template:default}{{name=Spotting Check:}} {{There was [[1d6>?{Range?|Up to 6" in soft or hard cover (not intact buildings),1|6" to 12" in soft cover,4|6" to 12" in hard cover (not intact buildings),5|Troops inside intact buildings up to 12",5}]] success}} The above works correctly, identifying the number of successes against the target number (i.e. 1 or 0) However, as soon as I start adding a modifier before the > sign then it all falls apart, so for example: EXAMPLE TWO &{template:default}{{name=Spotting Check:}} {{There was [[1d6+1>?{Range?|Up to 6" in soft or hard cover (not intact buildings),1|6" to 12" in soft cover,4|6" to 12" in hard cover (not intact buildings),5|Troops inside intact buildings up to 12",5}]] success}} The above changes the way the macro works, by counting the number rolled as the success, rather than comparing the sum against the target number; Ideally, I want the dice rolled to also be a variable, so something like: EXAMPLE THREE &{template:default}{{name=Spotting Check:}} {{There was [[1d6+?{Recon?|Yes,1|No,0}>?{Range?|Up to 6" in soft or hard cover (not intact buildings),1|6" to 12" in soft cover,4|6" to 12" in hard cover (not intact buildings),5|Troops inside intact buildings up to 12",5}]] success}} But again, this counts success as the sum of 1d6 plus the variable, rather than a comparison of a single digit against the target number. Hope this all makes sense - I am sure it is a simple syntax error...I had hoped to solve it myself, but 48 hours later and I am still drawing a blank. Can anyone help?
...and 5 minutes after posting, I figured it out: &{template:default}{{name=Spotting Check:}} {{There was [[{1d6+?{Recon?|Yes,+1|No,0}}>?{Range?|Up to 6" in soft or hard cover (not intact buildings),1|6" to 12" in soft cover,4|6" to 12" in hard cover (not intact buildings),5|Troops inside intact buildings up to 12",5}]] success}} I needed to add curly brackets around 1d6+VARIABLE ...!
1613938895
GiGs
Pro
Sheet Author
API Scripter
Normal parenthesis ( ) should work too.