DiceParser icon indicating copy to clipboard operation
DiceParser copied to clipboard

Problems with rerolling

Open ACleverDisguise opened this issue 2 years ago • 3 comments

The r/R modifiers don't seem to work in any way that I want them to.

What I'm trying to accomplish is "roll 3d6, rerolling on any sum less than 10".

Here's what I've tried.

!3d6r[<10] !3d6r[<10] !(3d6)r[<10] !3d6R[<10] !3d6R[<10] !(3d6)R[<10]

!3d6r[?<10] !3d6r[?<10] !(3d6)r[?<10] !3d6R[?<10] !3d6R[?<10] !(3d6)R[?<10]

!3d6r[:<10] !3d6r[:<10] !(3d6)r[:<10] !3d6R[:<10] !3d6R[:<10] !(3d6)R[:<10]

In all cases I got nothing like what I wanted. Either I got no result, timeout, or results that were clearly below 10 after several repeat rolls.

What's the trick? Or is this a bug in the r/R validator?

ACleverDisguise avatar Feb 22 '22 04:02 ACleverDisguise

First of all, the right command should be something like that: !3d6r[:<10] Yes, it does not do what you want but the other syntaxes are wrong.

!3d6r[<10] is always true !3d6r[?<10] is always true

I'm investigating the issue about the right syntax but I thing the R/r/a/e operator does not manage validator's compare method, they always do it as "on each dice".

obiwankennedy avatar Feb 23 '22 02:02 obiwankennedy

Well, when I tried the syntax that looked right and it failed, I also tried every other variant (because the docs aren't written for comprehension). I even tried * and . as operators, knowing that they're not going to work either, just to be complete. Grouping. Lower-case or upper-case R. *, ., :, or nothing. It all failed.

So how would I go about making a "3d6, reroll if under 10" using the DiceParser?

ACleverDisguise avatar Feb 25 '22 05:02 ACleverDisguise

As I said, I'm investigating on the issue about the right syntax. And it is was I thought Reroll does not manage compare methods for validator. I'm trying to add its support but it is an important change.

As a work around, you can use the if operator:

!3d6;$1i:[<10]{3d6};"Final score: $2"

If you want to check each result:

!3d6;$1i:[<10]{3d6};"Results: $1 - $2"

obiwankennedy avatar Feb 25 '22 13:02 obiwankennedy