< Dice
MacroContext Class
From DiceRoller Documentation
Contains the context for a macro and is passed to macro callbacks.
- Namespace: Dice
- Assembly: DiceRoller (in DiceRoller.dll)
Inheritance Hierarchy
System.Object
- Dice.MacroContext
Syntax
public class MacroContext
Constructors
Name | Description | |
---|---|---|
MacroContext(String) | Constructs a new instance of MacroContext. |
Properties
Name | Description | |
---|---|---|
Param | Gets the parameter passed to the macro. The callback is responsible for parsing this into something useful and acting accordingly. | |
Value | Gets or sets the result of the macro. | |
Values | Gets or sets the underlying die results for the macro that should be shown in the overall result. | |
ValueType | Gets or sets the type of value this macro returns. |
Remarks
A MacroContext is created and passed into all MacroCallbacks. The callback must fill out Value and should also fill out Values and ValueType. Failing to fill out Value will result in an error being displayed to the user.
The Param property contains the full string inside of the macro's square brackets. For example, the Param for the macro invocation [roll:1:critical]
is the string "roll:1:critical"
. All registered macro callbacks are invoked for every macro, unlike function callbacks which register themselves to a particular function name.