MacroRegistry.RegisterGlobalMacro Method (MacroCallback)

From DiceRoller Documentation

Registers a callback to the global macro registry. The same callback may be registered more than once.

  • Namespace: Dice
  • Assembly: DiceRoller (in DiceRoller.dll)

Syntax

public void RegisterGlobalMacro(
    MacroCallback callback
)

Parameters

callback
Type: Dice.MacroCallback
The method to be called whenever the macro is called in a dice expression.

Remarks

This registers a new global callback macro. The same callback can be registered multiple times; it is called as many times as it is registered. For example, registering a callback twice means that it will be called twice on each macro. The RemoveGlobal method can unregister all instances of a callback. Global macros are executed on each macro request, after all name-specific callbacks have fired. The exact order of evaluation is as follows:

  1. Name-specific macro callback on the RollData
  2. Name-specific macro callback on the RollerConfig (only if no name-specific RollData macros existed)
  3. Global callbacks on the RollData
  4. Global callbacks on the RollerConfig