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

Macro to query any value between an arbitrary minimum and maximum

I'm trying to make an inline ability that prompts the user to choose any value between 1 and 12 to add to a roll and display the roll result within the box. I can figure out how to do a basic query or a dropdown list, but dropdowns are slow and clumsy, and I don't want to make 12 options to choose from or do some weird workaround with new attributes. Is there any way I can use something like a comparator operation to check the input, then if it's below the minimum value to chooses the minimum value, and if it's above the maximum to choose the maximum? So basically, this kind of logic: Query user input X If X < 1, choose 1 If X > 12, choose 12 Output inline result Roll+X
1648599321
GiGs
Pro
Sheet Author
API Scripter
You can use the keep highest and keep lowest operators, but it's hard without seeing your code to know where to insert it. Something like this: {12{0,?{Pick a number from 1-12|1}kh1}kl1 The keep highest one looks like this: {0, 7}kh1 This will pick the highest of two numbers. If you want to keep the lowest of 2 numbers: {12, 7}kl1 You can nest one inside the other: {0, {12, 7}kl1 }kh1 Here the code first keeps the lowest of 12 and 7. Then the outer check is done, looking at the result of the inner test, comparing it to 0, and keeping the highest. And you can replace the 7 with a query like ?{Pick a number between 1 and 12|1} One problem is, if the user enters something this isnt a number, like misclicking the letter q, the operation will fail. This is where a dropdown is actually better. ?{Pick a number|1|2|3|4|5|6|7|8|9|10|11|12} The output will always be a number, and you wont have those errors. You can use the UP and DOWN arrows to go through the droppdown values very quickly. You don't have to click the drop down.