Difference between revisions of "Dice"

From DiceRoller Documentation
(create)
 
m (Skizzerz moved page API/Dice to Dice without leaving a redirect: redo page layout)
(No difference)

Revision as of 05:22, 9 April 2017

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.

Classes

Class Description
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.
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.
S FunctionRegistry Allows the user to register callbacks for functions.
MacroContext Contains the context for a macro, and is passed to macro callbacks.
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.
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.