Dice Namespace

From DiceRoller Documentation

The Dice namespace contains the base objects interacted with in the library. It is generally not needed to make use of the Dice.AST or Dice.Grammar namespaces in the course of normal interaction. However, advanced use cases may need to directly access objects in those namespaces.

The Dice.PbP namespace is useful if you need to keep track of multiple rolls in a play-by-post environment.

Classes

Class Description
S BuiltinFunctions Contains callbacks for all built-in functions. These functions are automatically registered whenever constructing a new RollerConfig object, but can be removed from the function registry if desired.
S BuiltinMacros Contains callbacks for all built-in macros. These macros are automatically registered whenever constructing a new RollerConfig object, but can be removed from the macro registry if desired.
DiceException The exception that is thrown whenever an error happens while evaluating a dice expression. This is used to signify an issue with the expression itself rather than any programming error.
DiceFunctionAttribute An attribute that can be applied to methods which denotes the method is a valid FunctionCallback. The FunctionRegistry.RegisterType function can be used to register types which contain methods marked with this attribute.
DiceMacroAttribute An attribute that can be applied to methods which denotes the method is a valid MacroCallback. The MacroRegistry.RegisterType function can be used to register types which contain methods marked with this attribute.
S ExtensionMethods Internal extension methods that are not useful for general consumption.
FunctionContext Contains the context for a function call, and is passed to function callbacks.
FunctionRegistry Allows the user to register callbacks for functions.
MacroRegistry Allows the user to register callbacks for macros.
InternalContext Opaque contextual information used when evaluating dice expressions.
MacroContext Contains the context for a macro, and is passed to macro callbacks.
RollData Holds data relevant to the scope of a single roll (as opposed to the global scope of RollerConfig).
S Roller Exposes a function to roll a dice expression.
RollerConfig Contains the configuration for a particular roll.
RollResult Contains the result of a roll expression.

Structures

Structure Description
DieResult Contains the result of an individual die.

Delegates

Delegate Description
FunctionCallback Encapsulates a method which executes function logic.
MacroCallback Encapsulates a method which executes macro logic.

Enumerations

Enumeration Description
DiceErrorCode Signifies what specific error happened when a DiceException is thrown. This can be used to deliver more user-friendly error messages to the user instead of the error messages created by DiceException without needing to resort to string parsing.
DieFlags Metadata attached to a DieResult. This metadata is not used internally, but may be useful to expose to the end user by changing how die results are displayed appropriately.
DieType Indicates what type of die was rolled for a DieResult.
FunctionScope When registering a function, this indicates what scopes the function should be registered to. When a FunctionCallback is called, this will indicate the scope from which the function was called from.
FunctionTiming When registering a function, this indicates when this function is called in the evaluation of extras and functions.
ResultType Indicates whether a RollResult's Value represents the total of the roll or the number of successes.
SpecialDie Some DieResults indicate that they are special dice rather than actual rolls. This enumeration indicates what type of special die the result is. Special dice are used as guidance for display, such as open/close parenthesis when nested math expressions are rolled so that the user can see the dice displayed in the same format as they were specified.