I’m not sure if CastSpell
is a function that works… I know there’s a CastSpellByName
function, but I don’t think it’s useable for casting most spells.
For example, you can test whether something works using the /script
command, ex:
/script OpenAllBags()
This should open all your bags, and
/script CloseAllbags()
should close them.
But, if you try to run something like:
/script CastSpellByName("Arcane Intellect(Rank 1)")
You’ll get a popup saying, “A macro script has been blocked from an action only available to the Blizzard UI.” AFAIK, you cannot use an addon to cast spells.
EDIT:
Also, I think there may be some typos in your addon. For example, you seem to be attempting to assign a function as the value to the SlashCmdList:
SlashCmdList[“BUFFS”] = local function buffshandler()
CastSpell(27126, arcane) --arcane intelect
CastSpell(31256, frost) --frost armor
end
Whereas, afaik, you would give the function declaration, then assign the function as a name to the SlashCmdList:
local function buffshandler()
CastSpell(27126, arcane) --arcane intelect
CastSpell(31256, frost) --frost armor
end
SlashCmdList[“BUFFS”] = buffshandler
Here’s a working example addon that just opens (/open
) and closes (/close
) all bags that may be useful as a starting point:
SLASH_OPEN1 = "/open"
SLASH_CLOSE1 = "/close"
local function openBags()
OpenAllBags()
end
local function closeBags()
CloseAllBags()
end
SlashCmdList["OPEN"] = openBags;
SlashCmdList["CLOSE"] = closeBags;