< Dice‎ | MacroRegistry
Revision as of 19:27, 15 September 2017 by Skizzerz (talk | contribs) (Created page with "{{APIdoc|MacroRegistry.RegisterGlobalMacro Method (MacroCallback)}} Registers a callback to the global macro registry. The same callback may be registered more than once. {{n...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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