Macro System
The Macro system provides a way to create and manage slash commands in the game. It allows you to register custom commands that can be executed through chat.
Basic Usage
First Run
On first run, you'll be prompted to set a prefix via a GUI window. This preference is saved for future sessions.
local Macro = Aurora.Macro
-- Register a simple command
Macro:RegisterCommand("hello", function(name)
print("Hello, " .. (name or "stranger") .. "!")
end, "Greets a player")
Command Registration
RegisterCommand
Macro:RegisterCommand(command, callback, description)
command
: String name for the commandcallback
: Function to execute when command is calleddescription
: Optional description for help text
Examples
Basic Command
-- Creates /aurora greet [name]
Macro:RegisterCommand("greet", function(name)
print("Hello, " .. (name or "stranger") .. "!")
end, "Greets a player")
Command with Arguments
-- Creates /aurora cast [spell]
Macro:RegisterCommand("cast", function(spell)
if spell then
Aurora.Spell:Cast(spell)
end
end, "Casts the specified spell")
Help Command
The help command can be accessed in two ways:
/aurora -- Lists all available commands
/aurora help -- Same as above
Both commands will display a list of all registered commands with their descriptions in the format:
/aurora commandName - Command description
Best Practices
Command Design
- Use clear, descriptive command names
- Always provide a helpful description
- Handle missing arguments gracefully
- Keep commands simple and focused
Common Pitfalls
- Avoid command names that might conflict with other addons
- Don't register commands in performance-critical code
- Remember to handle all possible argument cases