I've macro'd "/click ExtraActionButton1" in order to have a macro for various world quests and quests in general. Unfortunately the macro itself doesn't get the icon or tooltip of the respective item/spell.
I want to set the macro icon dynamically depending on the current item/spell that's in the ExtraActionButton1.
What I've come up with so far is:
Code:
local frame = CreateFrame("FRAME", "SetMacroIconForEAB1");
frame:RegisterEvent("UPDATE_EXTRA_ACTIONBAR");
local function eventHandler(self, event, ...)
for mi = 1, _G.MAX_ACCOUNT_MACROS + _G.MAX_CHARACTER_MACROS do
local str = "EAB1"
local name, icon, body = GetMacroInfo(mi)
if string.find(body,str) then
local button = _G['ExtraActionButton1']
local slot = ActionButton_GetPagedID(button) or ActionButton_CalculateAction(button) or button:GetAttribute('action') or 0
local actionType, id, _ = GetActionInfo(slot)
local actionName = GetSpellInfo(id)
print(aname,actionName)
SetMacroSpell(name,actionName)
break
end
end
end
frame:SetScript("OnEvent", eventHandler);
That doesn't work however. I suspect that the ExtraActionButton1 isn't accessible from the above lua code. Any suggestions?
Edit: Found out that the slot for the ExtraActionButton1 is 121. Tried with manually defining slot as 121, but GetActionInfo just returns "nil".