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

Problem with "keep higher" in dropdown query

I have a problem with macro. I want to use /roll {2d10+1d12}k2 and it works fine for its own, but when i use it in the query: ?{Roll type:|High, /roll {2d10+1d12}k2 |Medium,/roll 1d10+1d12 |Low,/roll 2d10kl1+1d12 } + ?{Bonus} it fails ( it asks for a "Role type" and takes the rest of the text by default ). I don't know why it fails and i can't find anything about it on the forum.
1610109797

Edited 1610118335
Jordan C.
Pro
API Scripter
You have right curly braces nested in the query which you can read more about in the wiki here . This means the query will end once it reaches the first right curly brace, which becomes evident when the input box contains this High,/roll {2d10+1d12 Notice the text stops right where a curly brace should be? That lets you know it needs to be escaped. So here is one where both are escaped using "}" - ?{Roll type:|High,/roll {2d10+1d12}k2 |Medium,/roll 1d10+1d12 |Low,/roll 2d10kl1+1d12 } + ?{Bonus} Edit: made a mistake by replacing the right curly brace before "?{bonus}" - fixed it in macro above.
1610109955

Edited 1610110059
David M.
Pro
API Scripter
EDIT - ninja'd! The problem lies in the closing brackets from the grouped die rolls. You will need to use html replacements as described here . I'd also recommend using inline rolls by placing the rolls within double brackets [[ ]] for a cleaner look, as well as the ability to format the rolls into some kind of roll template. I'd also also recommend putting the bonus query within each inline roll, which will return a total roll as a single number and allow mouseover to see the individual rolls. Finally, sometimes it's nice to have a descriptor tag for the mouseover to show where the numbers are coming from. To do this, just add [descriptorText] immediately after the inline roll. Here's an example using the default template with all the suggestions above: &{template:default} {{name=MacroName Here}} {{Roll=?{Roll type:|High,[[{2d10+1d12}k2[Base Roll]+?{Bonus}[Bonus]]] |Medium,[[(1d10+1d12)[Base Roll]+?{Bonus}[Bonus]]] |Low,[[(2d10kl1+1d12)[Base Roll]+?{Bonus}[Bonus]]]}}} Sample output for a "High" roll with a bonus of 5 Note that if you are using a Collections Tab macro, the html replacements will get eaten by roll20 if you ever re-open the macro again. To avoid this, best practice for these cases is to put the code into a character ability, as abilities will preserve the html replacements when you open them to view or edit.
Thanks for help ^^
1610115764
Andreas J.
Forum Champion
Sheet Author
Translator
It also a smart idea to minimize the amount of stuff you have in the query, jsut to reduce risk of mistakes when writing it. Rather than having /roll repeated all over the macro, it would be more efficient to do: /roll ?{Roll type:|High,{2d10+1d12&amp;#125;k2 |Medium,1d10+1d12 |Low,2d10kl1+1d12 &amp;#125; + ?{Bonus} <a href="https://wiki.roll20.net/Complete_Guide_to_Macros_%26_Rolls" rel="nofollow">https://wiki.roll20.net/Complete_Guide_to_Macros_%26_Rolls</a>