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

Dice Roller Macro fix

Hi everyone, I was tinkering with an already created Macro for rolling dice. The thing is, the macro allows for inputting number of dice, numer of sides and a modifier on top of the final roll. but i was trying to add another section that asks for a modifier to the sides of the rolls. This is the original macro: &{template:default} {name=Dice Roller}{{Results=[[?{How many?}{d?{Sides}+?{Mod}]]}} I know that if I manually input (n+x) when the prompt for sides appear, each roll will use the mod I apply, but cant get that to work as a separate promt that saves the need for writing parenthesis each time. This is what I tried: &{template:default} {name=Dice Roller}{{Results=[[?{How many?}{d?{Sides}?{mod}}+?{Mod}]]}}  ...and some other variations of that, with parenthesis, but can´t quite find the right combination. Any help is apreciated. Thank you in advance.
1590857779
vÍnce
Pro
Sheet Author
&{template:default} {{name=Dice Roller}} {{Results=[[ ?{How many?|1}d[[?{Sides|1}+?{sides mod|0}]]+?{Mod|0} ]]}}
I appreciate the attempt, but the number input in the sides mod prompt changes the dice sides. Which means that choosing 4, 6 sides, 2 sides mod...will roll 4d8. I tried it out and it even says so in the rolling part of the chat result. Furthermore, this made me realize that when I had manually written (6+2) in the sides prompt of the original code, it also rolled d8s, but wouldn´t say so in chat (I realized by rolling until i got a few 2s, when the lowest should have been 3s).
1590881652
GiGs
Pro
Sheet Author
API Scripter
Vince was likely led astray by your code here: &{template:default} {name=Dice Roller}{{Results=[[?{How many?}{d?{Sides}?{mod}}+?{Mod}]]}}  It looks like there's a mod that applies to the dice sides there, so vince gave you what he thought you were asking for. Try this tweak of Vince's code: &{template:default} {{name=Dice Roller}} {{Results=[[ ?{How many?|1}d?{Sides|1}+?{Mod|0} ]]}}
I thought I may have mislead someone with the code, sorry. Still not, that one functions just as the original one: &{template:default} {name=Dice Roller}{{Results=[[?{How many?}d?{Sides}+?{Mod}]]}} It lets me choose number of dice, sides of dice to roll and a mod to apply to the result. Just as a clarification, for I may have been messy with my explanations and/or formulas, what I´m looking for is the ability to choose a mod that will be applied to each of the rolled dice, on top of the number of dice and the number of sides. Meaning that I could choose to roll 4d6 and have a +2 on each of those d6s. Thank you anyway for the responses.
1590891267
GiGs
Pro
Sheet Author
API Scripter
Ah that is a different situation. You have to multiply the modifier by the number of dice: &{template:default} {{name=Dice Roller}} {{Results=[[?{How many?|1}d?{Sides|1}+(?{Mod|0}*?{How many?})]]}} Of you're rolling against a specific target, you can use grouped rolls, like &{template:default} {{name=Dice Roller}} {{Results=[[ { ?{How many?|1}d?{Sides|1}+?{Mod|0} }>?{Target|4} ]]}} The bit in bold is the extra stuff. But you cant do that with simple sum rolls, and have to use the multiplier version above for that.
Thank you very much. Its a nice way of achieving what I was looking for.
1591460731
GiGs
Pro
Sheet Author
API Scripter
Great :)