Quantcast
Need help setting a macro icon. - WoWInterface
Thread Tools Display Modes
10-15-20, 09:48 AM   #1
ujellyx
A Murloc Raider
Join Date: Jul 2019
Posts: 4
Question Need help setting a macro icon.

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".

Last edited by ujellyx : 10-16-20 at 03:18 PM.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Need help setting a macro icon.

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off