< Dice
Difference between revisions of "Dice/MacroContext"
From DiceRoller Documentation
(4 intermediate revisions by the same user not shown) | |||
Line 26: | Line 26: | ||
! Name !! Description | ! Name !! Description | ||
|- | |- | ||
− | | {{public}} {{property}} || [[/Param|Param]] || Gets the parameter passed to the macro. | + | | {{public}} {{property}} || [[/Arguments|Arguments]] || Gets the arguments of the macro (including the name), if using the recommended method of separating arguments with colons. |
+ | |- | ||
+ | | {{public}} {{property}} || [[/Data|Data]] || Gets roll data for the dice roll. | ||
+ | |- | ||
+ | | {{public}} {{property}} || [[/Name|Name]] || Gets the name of the macro, if using the recommended method of separating arguments with colons. | ||
+ | |- | ||
+ | | {{public}} {{property}} || [[/Param|Param]] || Gets the parameter passed to the macro. If not using the recommended method of separating arguments with colons, the callback is responsible for parsing this into something useful and acting accordingly. | ||
|- | |- | ||
| {{public}} {{property}} || [[/Value|Value]] || Gets or sets the result of the macro. | | {{public}} {{property}} || [[/Value|Value]] || Gets or sets the result of the macro. | ||
Line 38: | Line 44: | ||
A MacroContext is created and passed into all [[Dice/MacroCallback|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. | A MacroContext is created and passed into all [[Dice/MacroCallback|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 {{c|[roll:1:critical]}} is the string {{cs|"roll:1:critical"}}. | + | The Param property contains the full string inside of the macro's square brackets. For example, the Param for the macro invocation {{c|[roll:1:critical]}} is the string {{cs|"roll:1:critical"}}. The Name property would be {{cs|"roll"}} and the Arguments property would be the list {{cs|"roll", "1", "critical"}}. |
Latest revision as of 23:16, 14 August 2017
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, RollData) | Constructs a new instance of MacroContext. |
Properties
Name | Description | |
---|---|---|
Arguments | Gets the arguments of the macro (including the name), if using the recommended method of separating arguments with colons. | |
Data | Gets roll data for the dice roll. | |
Name | Gets the name of the macro, if using the recommended method of separating arguments with colons. | |
Param | Gets the parameter passed to the macro. If not using the recommended method of separating arguments with colons, 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"
. The Name property would be "roll"
and the Arguments property would be the list "roll", "1", "critical"
.