RollPlay Dice Strings

RollPlay supports dice strings with the following syntax for specifying collections of dice. The string is made up of one or more of dice descriptions separated by plus or minus signs, like so (square brackets indicate optional forms):

<dice object> = <dice description> [ +|- <dice description> ]*

A dice description describes at most one type of die to be rolled, the number of times to roll it, and a number by which to multiply the description. The dice description can be as simple as a constant. Also part of the dice description is the type of roll to be made (discussed below).

<dice description> = <constant> | <dice form>
<dice form> = [<multipler>][<number of dice>]<roll type><number of sides>[<keep>]
<multipler> = [<number>]x
<roll type> = d | s | t
<keep> = h|l<number to keep>

There are three types of rolls. The roll types are explained below, assuming that the dice form uses n sided dice.:

 d A stanard closed roll. The total dice rolled are added together. s A modified open roll. The total dice rolled are added together. t A open roll. The total dice rolled are added together.

The optional <keep> portion of a dice form provides a way to keep only a subset of the dice rolled in that dice form. The number following the code letter in the <keep> indicates how many dice to keep. If no <keep> is present, or the number of dice to keep exceeds the number of dice in the dice form, all dice in the form are used.

 h The subset of dice with the highest rolls are kept and added together to determine the total for the form. l The subset of dice with the lowest rolls are kept and added together to determine the total for the form.

Note that there are no parentheses in this system. The multiplier applies to the whole dice form but not the additions following it. This forces you to distribute if you need to. For example, if you wanted to have a die roll that rolled 5 four sided dice, added 2 and then multiplied the entire result by 3, you might be tempted to use 3x(5d4+2). This would be illegal. Instead, you must distribute it into 3x5d4 + 6. While somewhat inconvienent, the resulting formulae are easier to read, and you lose nothing.

Spaces are optional and are totally ignored in the dice object string.