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 .
×
Why do rogues wear leather armor? Because it’s made of hide. 🥷

Roll Query and Grouping Keep

1653755070

Edited 1653755076
John
Pro
I know you can build a grouping keep roll. For example, this /r {d6,d12}kh1 would roll a d6 and a d12, keeping only the highest one. However, I want to include this within a button on a custom character sheet. Additionally, I want to give two different grouping options for the player to choose from I would like the players o be prompted to choose between grouping option blue of {d6,d12}kh1 or grouping option red of {d4,d8}kh1.  I realize this format ?{Pick|Blue,{d6,d12}kh1|red,{d4,d8}kh1} is wrong. The {} within the groupings cause it to break. Can someone advise how to make it work?
1653756113

Edited 1653756269
vÍnce
Pro
Sheet Author
You'll need to substitute for the right brace in the query, otherwise the query will evaluate the first closing brace as the end of query. example of an inline roll; [[ ?{Pick | Blue , { d 6 ,d 12 } kh1 | Red , { d 4 ,d 8 } }kh1} ]] button example; <button type="roll" name="roll_foo" value=" [[ ?{Pick | Blue , { d 6 ,d 12 } kh1 | Red , { d 4 ,d 8 } }kh1} ]] "></button>
Thanks, but that does not seem to work. I copied the button example you posted. But when the query comes up it asks me to choose  Blue,{d6,d12 as the input value.
1653768311

Edited 1653768406
vÍnce
Pro
Sheet Author
John said: Thanks, but that does not seem to work. I copied the button example you posted. But when the query comes up it asks me to choose  Blue,{d6,d12 as the input value. Interesting...  Seems like another weird behavior of how the vtt parses sheet code.  Try double substituting.  Replace "&" with & like so; <button type="roll" name="roll_foo" value="[[ ?{Pick|Blue,{d6,d12}kh1|Red,{d4,d8}}kh1} ]]"></button>
1653783195

Edited 1653783411
GiGs
Pro
Sheet Author
API Scripter
The commas also need substituting. You can also move everything except the commas outside the query: { ?{Pick|Blue,d6,d12|red,d4,d8} }kh1 And you don't need to use commas. In this kind of operation, a + works fine { ?{Pick|Blue,d6+d12|red,d4+d8} }kh1 It'll still select the single highest die.
Perfect! This worked. Thank you both so much for the replies.