< Dice
Revision as of 16:29, 12 April 2017 by Skizzerz (talk | contribs) (Created page with "{{APIdoc|FunctionTiming Enumeration}} When registering a function, this indicates when this function is called in the evaluation of extras and functions. {{ns}} == Syntax ==...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

FunctionTiming Enumeration

From DiceRoller Documentation

When registering a function, this indicates when this function is called in the evaluation of extras and functions.

  • Namespace: Dice
  • Assembly: DiceRoller (in DiceRoller.dll)

Syntax

public enum FunctionTiming

Members

Member name Description
First The function should be executed before any other expressions.
BeforeExplode The function should be executed before any explode extras.
AfterExplode The function should be executed after any explode extras.
BeforeReroll The function should be executed before any reroll extras.
AfterReroll The function should be executed after any reroll extras.
BeforeKeep The function should be executed before any keep extras.
AfterKeep The function should be executed after any keep extras.
BeforeSuccess The function should be executed before any success extras.
AfterSuccess The function should be executed after any success extras.
BeforeCrit The function should be executed before any crit extras.
AfterCrit The function should be executed after any crit extras.
BeforeSort The function should be executed before any sort extras.
AfterSort The function should be executed after any sort extras.
Last The function should be executed after all other expressions.

Remarks

The ordering of the above member list is the order in which functions are executed (in other words, BeforeReroll happens before AfterReroll, which happens before BeforeKeep). Even if a particular extra does not apply to a roll (such as grouped rolls not having rerolls), these timings still happen.

If multiple functions are registered to the same timing, they will be executed in the order that the dice expression specifies them in. For example, if there are two functions .a() and .b() which both have FunctionTiming.BeforeKeep as their timing, the dice expression 1d20.a().b() will execute a before b, but 1d20.b().a() will execute b before a.

If a dice expression has multiple functions that have different timings, the functions are re-ordered so they are executed according to their timings. For example, if .a() was registered as FunctionTiming.BeforeKeep and .b() was registered as FunctionTiming.AfterSort, the dice expression 4d6dl1.b().a() will execute a first, then drop the lowest die, then execute b.