Difference between revisions of "Dice"

From DiceRoller Documentation
m (Skizzerz moved page API/Dice to Dice without leaving a redirect: redo page layout)
m
Line 1: Line 1:
 
{{APIdoc|Dice Namespace}}
 
{{APIdoc|Dice Namespace}}
The Dice namespace contains the base objects interacted with in the library. It is generally not needed to make use of the [[API/Dice/AST|Dice.AST]] or [[API/Dice/Grammar|Dice.Grammar]] namespaces in the course of normal interaction. However, advanced use cases may need to directly access objects in those namespaces.
+
The Dice namespace contains the base objects interacted with in the library. It is generally not needed to make use of the [[Dice/AST|Dice.AST]] or [[Dice/Grammar|Dice.Grammar]] namespaces in the course of normal interaction. However, advanced use cases may need to directly access objects in those namespaces.
  
 
== Classes ==
 
== Classes ==
Line 7: Line 7:
 
! Class !! Description
 
! Class !! Description
 
|-
 
|-
| {{public}} {{class}} || [[API/DiceException|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.
+
| {{public}} {{class}} || [[Dice/DiceException|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.
 
|-
 
|-
| {{public}} {{class}} || [[API/DiceFunctionAttribute|DiceFunctionAttribute]] || An attribute that can be applied to methods which denotes the method is a valid [[API/FunctionCallback|FunctionCallback]]. The [[API/FunctionRegistry/RegisterType|FunctionRegistry.RegisterType]] function can be used to register types which contain methods marked with this attribute.
+
| {{public}} {{class}} || [[Dice/DiceFunctionAttribute|DiceFunctionAttribute]] || An attribute that can be applied to methods which denotes the method is a valid [[Dice/FunctionCallback|FunctionCallback]]. The [[Dice/FunctionRegistry/RegisterType|FunctionRegistry.RegisterType]] function can be used to register types which contain methods marked with this attribute.
 
|-
 
|-
| {{internal}} {{static}} {{class}} || [[API/ExtensionMethods|ExtensionMethods]] || Internal extension methods that are not useful for general consumption.
+
| {{internal}} {{static}} {{class}} || [[Dice/ExtensionMethods|ExtensionMethods]] || Internal extension methods that are not useful for general consumption.
 
|-
 
|-
| {{public}} {{class}} || [[API/FunctionContext|FunctionContext]] || Contains the context for a function call, and is passed to function callbacks.
+
| {{public}} {{class}} || [[Dice/FunctionContext|FunctionContext]] || Contains the context for a function call, and is passed to function callbacks.
 
|-
 
|-
| {{public}} {{static}} {{class}} || [[API/FunctionRegistry|FunctionRegistry]] || Allows the user to register callbacks for functions.
+
| {{public}} {{static}} {{class}} || [[Dice/FunctionRegistry|FunctionRegistry]] || Allows the user to register callbacks for functions.
 
|-
 
|-
| {{public}} {{class}} || [[API/MacroContext|MacroContext]] || Contains the context for a macro, and is passed to macro callbacks.
+
| {{public}} {{class}} || [[Dice/MacroContext|MacroContext]] || Contains the context for a macro, and is passed to macro callbacks.
 
|-
 
|-
| {{public}} {{static}} {{class}} || [[API/Roller|Roller]] || Exposes a function to roll a dice expression.
+
| {{public}} {{static}} {{class}} || [[Dice/Roller|Roller]] || Exposes a function to roll a dice expression.
 
|-
 
|-
| {{public}} {{class}} || [[API/RollerConfig|RollerConfig]] || Contains the configuration for a particular roll.
+
| {{public}} {{class}} || [[Dice/RollerConfig|RollerConfig]] || Contains the configuration for a particular roll.
 
|-
 
|-
| {{public}} {{class}} || [[API/RollResult|RollResult]] || Contains the result of a roll expression.
+
| {{public}} {{class}} || [[Dice/RollResult|RollResult]] || Contains the result of a roll expression.
 
|}
 
|}
  
Line 31: Line 31:
 
! Structure !! Description
 
! Structure !! Description
 
|-
 
|-
| {{public}} {{struct}} || [[API/DieResult|DieResult]] || Contains the result of an individual die.
+
| {{public}} {{struct}} || [[Dice/DieResult|DieResult]] || Contains the result of an individual die.
 
|}
 
|}
  
Line 39: Line 39:
 
! Delegate !! Description
 
! Delegate !! Description
 
|-
 
|-
| {{public}} {{delegate}} || [[API/FunctionCallback|FunctionCallback]] || Encapsulates a method which executes function logic.
+
| {{public}} {{delegate}} || [[Dice/FunctionCallback|FunctionCallback]] || Encapsulates a method which executes function logic.
 
|-
 
|-
| {{public}} {{delegate}} || [[API/MacroCallback|MacroCallback]] || Encapsulates a method which executes macro logic.
+
| {{public}} {{delegate}} || [[Dice/MacroCallback|MacroCallback]] || Encapsulates a method which executes macro logic.
 
|}
 
|}
  
Line 49: Line 49:
 
! Enumeration !! Description
 
! Enumeration !! Description
 
|-
 
|-
| {{public}} {{enum}} || [[API/DiceErrorCode|DiceErrorCode]] || Signifies what specific error happened when a [[API/DiceException|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.
+
| {{public}} {{enum}} || [[Dice/DiceErrorCode|DiceErrorCode]] || Signifies what specific error happened when a [[Dice/DiceException|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.
 
|-
 
|-
| {{public}} {{enum}} || [[API/DieFlags|DieFlags]] || Metadata attached to a [[API/DieResult|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.
+
| {{public}} {{enum}} || [[Dice/DieFlags|DieFlags]] || Metadata attached to a [[Dice/DieResult|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.
 
|-
 
|-
| {{public}} {{enum}} || [[API/DieType|DieType]] || Indicates what type of die was rolled for a DieResult.
+
| {{public}} {{enum}} || [[Dice/DieType|DieType]] || Indicates what type of die was rolled for a DieResult.
 
|-
 
|-
| {{public}} {{enum}} || [[API/FunctionScope|FunctionScope]] || When registering a function, this indicates what scopes the function should be registered to. When a [[API/FunctionCallback|FunctionCallback]] is called, this will indicate the scope from which the function was called from.
+
| {{public}} {{enum}} || [[Dice/FunctionScope|FunctionScope]] || When registering a function, this indicates what scopes the function should be registered to. When a [[Dice/FunctionCallback|FunctionCallback]] is called, this will indicate the scope from which the function was called from.
 
|-
 
|-
| {{public}} {{enum}} || [[API/FunctionTiming|FunctionTiming]] || When registering a function, this indicates when this function is called in the evaluation of extras and functions.
+
| {{public}} {{enum}} || [[Dice/FunctionTiming|FunctionTiming]] || When registering a function, this indicates when this function is called in the evaluation of extras and functions.
 
|-
 
|-
| {{public}} {{enum}} || [[API/SpecialDie|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.
+
| {{public}} {{enum}} || [[Dice/SpecialDie|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.
 
|}
 
|}

Revision as of 05:24, 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.