Difference between revisions of "Dice/MacroContext"

From DiceRoller Documentation
Line 25: Line 25:
 
! style="width: 5em" |
 
! style="width: 5em" |
 
! Name !! Description
 
! Name !! Description
 +
|-
 +
| {{public}} {{property}} || [[/Data|Data]] || Gets roll data for the dice roll.
 
|-
 
|-
 
| {{public}} {{property}} || [[/Param|Param]] || Gets the parameter passed to the macro. The callback is responsible for parsing this into something useful and acting accordingly.
 
| {{public}} {{property}} || [[/Param|Param]] || Gets the parameter passed to the macro. The callback is responsible for parsing this into something useful and acting accordingly.

Revision as of 23:12, 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
Data Gets roll data for the dice roll.
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.