The page "QdrEs.Formulas" doesn't exist.

*English version:*

Formulas are the core of Quick Dice Roller.

Formulas are used to instruct Quick Dice Roller on what kind of roll we want, and can be as simple as "`1d6`

" (*roll a six sided dice*) or a bit more complex, like "`max(1d6, 1d8)`

" (*get the highest result between a six sided dice and an eight sided dice*) and even more complex to fit your needs.

This page will help you to fully understand how formulas works.

A **value** is the basic information usable in QDR Formulas. It can be expressed as a number (like "`10`

") or can be the result of an operation (like "`3 + 5`

"), or the result of a function (like "`max(d6,d6)`

").

A value can hold up to three decimal values, but all the decimals are truncated in the final result (i.e. the formula "`(2/3)+0.5`

" returns `1`

and the formula "`rup((2/3)+0.5)`

" will obviously return `2`

).

Each value in QDR is composed by a *numeric* (shown as the numeric result) and a *label* (shown as the extended result).

Let’s take in example the addition. It take two operands (right and left) that are two distinct values and generates a new value whose *numeric* is the sum of the *numerics* of the operands, and the *label* is the concatenation of the operands' *labels* separated by "` + `

". Thus, the formula "`3 + 2`

" will sum two values: first value is composed by the *numeric* `3`

and the *label* "`3`

", second value is composed by the *numeric* `2`

and the *label* "`2`

". The result of the addition will be a new value composed by the *numeric* `5`

and the *label* "`3 + 2`

".

Functions and operators works with *numerics* and *labels* and each one generates a new **value**, whose *numeric* and *label* depends on the operation performed by the operator or the function.

Quick Dice Roller support the main four **operators** (`+`

,`*`

,`-`

,`/`

) as well as the special `d`

operator.

The output of such operators is a value with the *numeric* equal to the numeric result of the operation, and the *label* equal to the labels of the two operators separated by the operator (i.e. "`3*2`

").

The special `d`

operator is used to roll dice. As most of you already know, "`2d6`

" means *roll two times a six faced die, and add all the results together*.

The `d`

operator has the highest priority, and is evaluated before any other operator, thus "`2d6*3`

" means *add the result of two six sided dice and then multiply it by 3*.

The output of the `d`

operator is a value with the *numeric* equal to the numeric result of the roll, and the *label* equal to the numeric result surrounded by square brackets (i.e. "`[5]*3`

").

If the number of dice to roll is less or equal to `0`

, then no dice are rolled at all. If the number of faces is less or equal to `1`

, then a single sided dice (i.e. a dice that will always return `1`

) is rolled.

It is possible to use `t`

(swedish tärning) or `w`

(deutch würfel) as alternative of `d`

.

**Parentheses** are used to specify the order of the computation.

As said, the `d`

operator is computed before of the `*`

operator, and the latter is computed before of the `+`

operator. So, the formula "`2d6*3+4`

" means *roll two six sided dice, add the result together, multiply it by 3 and then add 4*.

Using parentheses it is possible to modify that order: whatever is put between them is computed before of the operators outside them. I.e. the formula "`2d(6*(3+4))`

" means *add together 3 and 4, multiply the result by 6 and then roll two dice with a number of faces equal to the result*. Or, in other words, *roll two 42 sided dice and add the result together*.

**Named Values** are values that can be referenced by a name and can be changed prior of each evaluation of the formula.

Named Values can be created, deleted and updated using their special interface (swipe right to left to access it). The short name (Label) of the Named Values can be used in formulas. The current value of Named Values will be used in place of their short name when evaluating formulas.

Example: let's assume we created a Named Value with the short name "`lvl`

". We can now create the formula "`(lvl)d6`

" that roll as many six sided dice as the current value of the Named Value "`lvl`

". Changing the value of "`lvl`

" will lead to a different amount of dice rolled.

**Functions** are used to perform complex rolls, like exploding die, dice pool, roll & keep and so on.

Functions are composed by their name followed by a set of parameters enclosed in parentheses, and each parameter is separated by a comma. A typical example is "`rak(1d6,4,3)`

" and its meaning is as follows: *use the function with name rak with three parameters. First parameter is " 1d6", second parameter is "4" and third parameter is "3"*.

Each parameter of a function can be any formula, even another function, like "`max(rak(1d6,4,3),5+2)`

" which give the highest value between the result of "`rak(1d6,4,3)`

" and "`5+2`

".

To get the complete list of available functions, check the Function Reference page.

Obtenido de http://www.ohmnibus.net/wiki/index.php?n=QdrEs.Formulas

Última modificación de la página el 19 de January de 2019 a las 04h25