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

Multiple Conditions For Reroll?

1567907250

Edited 1567908834
I'm trying to make a reroll macro with mutiple conditions. The basic details are, roll 1d20, and if your result if between 2 and 9, you can reroll it, once. I can almost sort of get this to work, but there are problems. 1d20r<9 properly rerolls if you get anything 9 or less. 1d20r>2 properly rerolls 2 and higher. 1d20r>2r<9 doesn't work. It doesn't know which condition to prioritize, so they keep overriding each other, until eventually after like 1000 rolls it just stops and gives you a 1. There are SOME ways I can get it to accept multiple conditions, but the trouble is, that only works for regular rerolls, which are unlimited. If I use the 'only reroll once' command (1d20 ro <9), it won't let me give multiple conditions. It just straight up breaks. 1d20ro2ro3 SHOULD be easy and simple, doing a single reroll on a 2 or 3, but it doesn't work at all. It just breaks and returns a result of 1 into the chat without actually rolling a dice. Is there a solution?
1567937390
GiGs
Pro
Sheet Author
API Scripter
Unfortunately no, there is no solution to this. I've tried to do similar things in the past, and dice roller cant cope with multiple conditionals like this. There are three ways to get around this: Upgrade to Pro and use the API. A custom script can handle this. Create a rollable table to use in place of the die. Since there's only one rerall, calculating all the possibilities is not that hard. Just let people reroll manually. You could print out a button with each roll, with the word "reroll" on it, which people can click and reroll. Since you're only doing one reroll, the rollable table is actually a pretty good solution (and it's rare for me to say that, because i find roll20's table feature woefully incomplete). To create the needed rollable table, create a table with 20 entries, numbered 1-20. In the weight column, for numbers 2-9 enter 2, and for every other number enter 7. That will give you the accurate probabilities for rolling a d20, and rerolling the first 2-9. You wont see a reroll, but the effect is identical. You could even enter a dice image for each entry - a d20 showing a 1, for 1, etc. But thats a bit of extra work and isnt needed. If you call the table "rerolld20", you use it in your dice macro by writing 1t[rerolld20] and it works exactly like typing 1d20 . 
1567938257

Edited 1567938647
GiGs
Pro
Sheet Author
API Scripter
Though I would add, if youre rerolling 40% of the dice from the first roll, is a d20 really the best way to do your rolls? Just using 2d20 in all cases, and taking the highest, is a simpler mechanic and the odds are really close for all numbers in the range (which isnt surprising, because 40% of the time, you're rolling 2d20 anyway). Here's a graph of both slopes The chance of each number doesnt vary too much in either approach, with the singular exception of number 1. If that's important, you could fix that with a rule "if either roll is a 1, treat it as 1" I think it's a better experience in game play at the table to roll both dice together, than having to roll one, look at the roll, then nearly half the time ignore it and roll again (and the worst experience in reroll systems: sometimes getting a worst result). While that's moot for roll20, it's also easier to program in roll20, you just need to use the keep highest expression: {2d20}kh1
Hmm, that's disappointing that it can't be done. Thanks for the insights and alternative ideas though!
This can be done pretty easily using the Powercard Script.  Here's a version I just wrote up: !power {{ --name|Roll --leftsub|Re-roll if between 2 and 9 --hroll|[[ [$RollOne] 1d20 ]] [[ [$RollTwo] 1d20 ]] -- ?? $RollOne.base == 1 OR $RollOne.base > 9 ?? 1 First Roll:|Your first roll was [^RollOne].  Let's keep it! -- ?? $RollOne.base > 1 AND $RollOne.base < 10 ?? 1 First Roll:|Your first roll was [^RollOne].  Let's use [^RollTwo] instead!  }}
1568380953
GiGs
Pro
Sheet Author
API Scripter
btw Power Cards needs the API, which is perk of being a Pro subscriber. 
Thanks for that info as well!