The experiments I am about to perform will be based on the
General RPoL thread:
Multiple Rolls with Manual Die Roller?
The basic issue discussed in the linked thread was that making multiple rolls "manually" in the dice roller resulted in some strange errors if the first roll in the set was one preceded by a constant from which the first dice roll was subtracted.
The example string of dice rolls was:
quote:
For example: 14-3d6,3d6,1d6+1 I expected to see results like 3, 13, 4 (all positive values)
Instead I get: rolled 9,-10,-4 using 14-3d6,3d6,1d6+1 with rolls of 3,1,1,3,3,4,5.
This led to further experimentation by the original poster, chiefly moving the 14-3d6 roll to the end of the queue.
An assertion (which appears to be correct if the individual results are considered separately) was made by a respondent that the subtraction (or negation) that occurs in 14-3d6 was also applied to the subsequent dice rolls in the set.
Well, the short answer so far is that symbols of inclusion (such as parentheses, square brackets, or braces) all throw syntax errors.
Additionally, enclosing each expression in its own set of quotes (as the dice roller examples below the field indicate) also throws an error. The expression list must not be bounded by quotes at all, since the dice roller adds them automagically around the entire list.
It's beginning to look like the intended syntax for each comma-separated expression is XdY plus or minus DM value (where DM = Dice Modifier) with the sign and DM value optional and omissible.
In some cases, an X value of 1 may be omitted, and dice strings for the rolling of one die with Y sides may be expressed simply as dY. Note that for certain forms of dice roll strings (notably reversed strings involving subtraction) this "implied 1" format
does not work correctly.
Hmm...
Using the string 3d6+7,2d6-4,d20+8,d16-7 yielded:
01:40, Today: Homunculus rolled 12,2,12,-5 using 3d6+7,2d6-4,d20+8,d16-7 ((2,1,2,1,5,4,2)).
Let's see now:
2+1+2+7 = 12
1+5-4 = 2
4+8 = 12
2-7 = -5
It would appear that so long as the dice come first in each string, the operations remain properly correct and separate from each others' influence sign-wise.
Hmm... the string 20-d20,12-d12,6-d6 throws an error stating that - is an invalid number of dice.
Replacing this with 20-1d20,12-1d12,6-1d6 yielded more interesting results:
01:48, Today: Homunculus rolled 2,5,3 using 20-1d20,12-1d12,6-1d6 ((18,7,3)).
20-18 = 2
12-7 = 5
6-3 = 3
So far, so good. It's worth noting that in a reversed (Constant - dice roll) expression, so long as all dice rolls are of this type and all dice are preceded by a number (even if it is a 1), their results were correct. Omitting preceding numbers in dice strings (the "implied 1" form) tends to lead to errors in reversed form strings. That is:
20-1d20,12-1d12,6-1d6 is acceptable for reversed format entries, but...
20-d20,12-d12,6-d6 is NOT acceptable for entries of this type.
Let's see what happen if the sign changes for the middle roll in this set:
20-d20,12+d12,6-d6 yields:
01:57, Today: Homunculus rolled 3,0,4 using 20-1d20,12+1d12,6-1d6 ((17,12;2)).
20-17 = 3
12+12 <> 0 (!) {it appears that first "subtraction also negates the + in this expression.}
6-2 = 4, so the negation did not carry over to negate the subtraction.
CONCLUSIONS:
So long as a number greater than zero is always specified in the dice string in the X position of XdY (not considering any preceding sign), the dice roll strings will be parsed correctly so long as none of them is expressed in "reversed subtractive" (Constant - Dice Roll) format.
If a reversed format roll is needed, it is best to express it singly, more especially so if it involves subtraction as opposed to addition, however, if multiple reversed rolls involving subtraction
are needed, so long as they
are not mixed with those requiring addition, their results will be parsed correctly.
(This has some possibly interesting implications for those of us using The Black Hack, The Petal Hack, or systems which use a similar "Stat Check" mechanic where success is achieved by rolling below a given value.)
We theorize from the foregoing that reversed subtractive format rolls
were not anticipated in the design of the dice roller, and that the rules of their parsing are
an unintended consequence rather than by intentional design.
{Please note this is
not intended as a criticism of the Dice Roller. It is, rather, an observation on the tendency of users to find exploits, loopholes, and other hidden flaws in a coder's designs. This sort of thing amounts to a hack of the Dice Roller to get it to perform in some ways beyond its original specifications.}
As such, while there are special cases where reversed format dice rolls are parsed correctly, namely "all additive" or "all subtractive", care should be exercised in using any other cases, and results should be verified to be in line with those expected.