ExDiceRoller v1.0.0-rc.2 ExDiceRoller.Sigil View Source
Han dles the sigil ~a
for dice rolling. If no options are specified, the
sigil will return the compiled function based on the provided roll. Note that
variables cannot be present in the expression when invoking a roll directly
from the sigil.
Also note that if you wish to use the /
operator with the sigil, you will
need to use a different delimeter. Example: ~a|1d4+4d6/2d4|
.
The following options are available, with each invoking a roll:
r
: Compiles and invokes the roll. Variables are not supported with this.e
: Turns on the exploding dice mechanic.h
: Select the highest of the calculated values when using the,
separator.l
: Select the highest of the calculated values when using the,
separator.k
: Keeps the value for each dice roll and returns it as a list.
Examples
iex> import ExDiceRoller.Sigil
ExDiceRoller.Sigil
iex> fun = ~a/1+1/
iex> fun.([])
2
iex> import ExDiceRoller.Sigil
iex> fun = ~a/1d4/
iex> fun.([])
1
iex> fun.([])
4
iex> import ExDiceRoller.Sigil
iex> ~a/1d6+1/r
4
iex> ~a/1d2/re
7