API GetMacroSpell

From Wowpedia
Jump to: navigation, search

Returns information about the spell a given macro is set to cast. This function can be used by action bar addons to display dynamic macro icons and tooltips. As a macro's cast sequence changes, this function can be queried to get the next spell that will be cast.


name, rank, id = GetMacroSpell(slot) or GetMacroSpell(macroName)


Arguments:

slot 
number - The macro slot to query
macroName 
string - The name of the macro to query


Returns:

name 
string - The name of the spell the macro is currently set to cast
rank 
string - The rank of the spell (largely obsolete since 4.0)
id 
number - The spellID of the spell

Examples:

local index = GetMacroIndexByName(macroName)
if index then 
    local spellName, _, spellID = GetMacroSpell(index)
    local spellLink = GetSpellLink(spellID)
    DEFAULT_CHAT_FRAME:AddMessage(macroName .. " will cast " .. spellLink)
end
local macroName = "MyMacro"
local spellName, _, spellID = GetMacroSpell(macroName)
local spellLink = GetSpellLink(spellID)
DEFAULT_CHAT_FRAME:AddMessage(macroName .. " will cast " .. spellLink)