< Dice‎ | MacroRegistry
Revision as of 19:21, 15 September 2017 by Skizzerz (talk | contribs) (Created page with "{{APIdoc|MacroRegistry.RegisterMacro Method (String, MacroCallback)}} Registers the specified callback to the given name. {{ns}} == Syntax == <syntaxhighlight lang="C#"> pub...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

MacroRegistry.RegisterMacro Method (String, MacroCallback)

From DiceRoller Documentation

Registers the specified callback to the given name.

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

Syntax

public void RegisterMacro(
    string name,
    MacroCallback callback
)

Parameters

name
Type: System.String
Macro name to register. Macro names are case-insensitive.
callback
Type: Dice.MacroCallback
The method to be called whenever the macro is called in a dice expression.

Exceptions

Exception Condition
ArgumentNullException name is null.
ArgumentException name is the empty string.
InvalidOperationException A macro with the same name has already been registered.

Remarks

This registers a new macro with the given name.

There can only be one callback associated with any given macro name. It is an error to re-register a macro, but a macro can be removed and then registered again.