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 .
×

Macro help for shadowrun style compounding dice with optional additional dice pool

1688479948

Edited 1688480246
Dear Roll20 Community, I was trying to create a macro that allows the user to input the number of base dice, the number of pool dice to add and a target number. This would be useful  for determining fumbles, when the base dice all come out as 1s. This seems to work fine so far: /me rolls ?{Amount of base dice} base dice and ?{Amount of pool dice} pool dice against Target Number ?{Target|4} /r {?{Amount of base dice}D6!!}>?{Target|4} + {?{Amount of pool dice}D6!!}>?{Target|4} But when I try to use zero pool dice, it breaks and the system does not roll anything. Has anyone got any tips on how to roll two set of dice against the same target number, that doesnt break when zero dice are used? Thanks H.
1688481115
GiGs
Pro
Sheet Author
API Scripter
What do you mean by breaking? It works fine for me when I enter 0?
1688481884

Edited 1688481923
GiGs
Pro
Sheet Author
API Scripter
Personally I'd use the default roll template, and make it so people only enter values once and in an easy to remember order: &{template:default} {{name=Dice Roll}} {{Base Dice=?{Amount of base dice|0} }} {{Pool Dice=?{Amount of pool dice|0} }} {{Difficulty=?{Difficulty|4} }} {{ Result= [[ {[[?{Amount of base dice} + ?{Amount of pool dice}]]d6!!}>?{Difficulty} ]] }} This a complex roll!
1688482114

Edited 1688482490
Gauss
Forum Champion
GiGs are you hitting enter with a blank box or entering "0"? When I enter "0" it also doesn't work for me. A blank box is being treated as a "null"d6...ie: 1d6 while a "0" is being treated as a 0, no d6 roll which is messing with the {0}>target portion.  Edit: example of what isn't working:  /r {0d6!!}>4 Here is the fix:  /r {?{Amount of base dice}D6!!}>?{Target|4} + {[[?{Amount of pool dice}D6!!]]+1d0}>?{Target|4} I believe the reason it wasn't working is that 0d6!! resolves into "0" which doesn't work with success/failure. It needs a dice roll. So enclosing the Xd6!! in inline brackets and adding a fake roll (1d0) resolves the problem.
1688485907
GiGs
Pro
Sheet Author
API Scripter
I see where the issue is, Gauss. In my fixed macro I had entered |0, so ?{Amount of base dice|0},  so the default was 0, and it worked fine. If you leave it as ?{Amount of base dice} it does error. But really, when entering a number, you shouldnt do that anyway.
1688486092
GiGs
Pro
Sheet Author
API Scripter
For things like this, you are better off entering as a dropdown anywayway, like ?{Amount of base dice|0|1|2|3|4|5|6|7|8|9|10} with every possible number listed (ditto for the difficulty, though use 4 as the first one). People dont have to use the dropdown, they can type a number. If you rely on text input, there will be errors at some point. With an approach like this, it will only accept the listed results and so the macro always works.
1688543140

Edited 1688545611
The roll template looks fine, although the whole purpose of the macro was to see if the base dice roll came up all 1s, to see if it is a fumble. And this can not be seen in the template, since the result is a check against the combination of all dice. I'll try to phrase it more clearly: 1. You do a skill check with two base dice and two pool dice. 2. The two base dice come up as 1s. 3. The two pool dice come up as whatever. 4. Since all the base dice are 1s, the system should report a fumble, with no regard to the pool dice So in a template it should look something like this when all the base dice are 1s: Base Dice 2 Pool Dice 2 Result FUMBLE! I hope this makes it more clear. Sorry for the unprecise first post.
Gauss said: Here is the fix:  /r {?{Amount of base dice}D6!!}>?{Target|4} + {[[?{Amount of pool dice}D6!!]]+1d0}>?{Target|4} I also got this in the end, but was put off by the extra 0 in the result.
1688548112
GiGs
Pro
Sheet Author
API Scripter
Hugo H. said: The roll template looks fine, although the whole purpose of the macro was to see if the base dice roll came up all 1s, to see if it is a fumble. And this can not be seen in the template, since the result is a check against the combination of all dice. Yes, this is a drawback of rolltemplates. If you use them, you cant see at a glance the individual rolls beacuse inline rolls have to be used. You can hover the mouse over the results and see each die.
Huh. I guess this is one of the few differences in how /roll and inline rolls work. /r {0d6!!}>4 will error silently whereas [[ {0d6!!}>4 ]] behaves as expected. GiGs said: Personally I'd use the default roll template, and make it so people only enter values once and in an easy to remember order: Queries are shared across multiple input lines. So if the emote and roll are part of the same macro you don't have to re-enter the query values. Gauss said: Here is the fix:  /r {?{Amount of base dice}D6!!}>?{Target|4} + {[[?{Amount of pool dice}D6!!]]+1d0}>?{Target|4} I believe the reason it wasn't working is that 0d6!! resolves into "0" which doesn't work with success/failure. It needs a dice roll. So enclosing the Xd6!! in inline brackets and adding a fake roll (1d0) resolves the problem. I think you're forgetting how single sub-expression group rolls behave. You've gone from checking the target against each roll to checking the target against the sum of the rolls by using the inline brackets and fake roll. Since a modifier isn't being used the group syntax is unnecessary. So it can be reworked as /r ?{Amount of base dice}D6>?{Target|4}!! + ?{Amount of pool dice}D6>?{Target|4}!! Although you may want to consider GiGs comments on using dropdowns for the queries
1688560908
Gauss
Forum Champion
Gauss said: Here is the fix:  /r {?{Amount of base dice}D6!!}>?{Target|4} + {[[?{Amount of pool dice}D6!!]]+1d0}>?{Target|4} I believe the reason it wasn't working is that 0d6!! resolves into "0" which doesn't work with success/failure. It needs a dice roll. So enclosing the Xd6!! in inline brackets and adding a fake roll (1d0) resolves the problem. I think you're forgetting how single sub-expression group rolls behave. You've gone from checking the target against each roll to checking the target against the sum of the rolls by using the inline brackets and fake roll. Since a modifier isn't being used the group syntax is unnecessary. So it can be reworked as /r ?{Amount of base dice}D6>?{Target|4}!! + ?{Amount of pool dice}D6>?{Target|4}!! Although you may want to consider GiGs comments on using dropdowns for the queries Thanks for the correction RainbowEncoder :) I should have looked at that in more depth but brain has been busy with other things. 
1688568864
GiGs
Pro
Sheet Author
API Scripter
RainbowEncoder said: Huh. I guess this is one of the few differences in how /roll and inline rolls work. /r {0d6!!}>4 will error silently whereas [[ {0d6!!}>4 ]] behaves as expected. Interesting. I only discovered that because of this very thread.