Looking to make a macro with universal #show

The answer to that depends on if you want the artwork to change based on any condition.

If the answer is no you want it the same icon always, yes you can pick one of the 25k icons (find something you like on wowhead and click its icon enough times and you’ll get a name like inv_sword_11 for Devastate) or you can use any artwork that works in WoW (some restrictions on dimensions and such) and copy and paste this into chat (if it’s not from interface\icons you need to give the rest of the path too):

/run EditMacro("macroname",nil,"inv_sword_11")

If the answer is yes you want it to change based on [condition], then it becomes hard. You can’t EditMacro in combat. If the macro is on a bar that doesn’t page, it’s possible to script some hooks onto the button’s SetTexture, something like the following:

local condition = "[mounted] interface\\icons\\inv_sword_11; interface\\icons\\inv_misc_coin_01"
local icon = MultiBarBottomLeftButton9Icon
local current = SecureCmdOptionParse(condition)
local updating = false

local function setIcon()
  updating = true
  current = SecureCmdOptionParse(condition)
  icon:SetTexture(current)
  updating = false
end

hooksecurefunc(icon,"SetTexture",function(self)
  if not updating then
    setIcon()
  end
end)

local f = CreateFrame("Frame")
RegisterStateDriver(f, "iconchoice", condition)
f:SetScript("OnAttributeChanged",function(self,name,value)
  setIcon()
end)

setIcon()

Paste that into https://addon.bool.no/ to turn it into an addon to make the icon for MultiBarBottomLeftButton9 change to the icons in the condition at the top of the code.

But if the icon you want to change is on a bar that pages, then the complexity increases.

So the TL;DR answer to this

is not really once you add the word “easy”. It will take a lot of coding for an addon to do it.

Blizzard has the ability to let us do it easily. They could give us SetMacroIcon (that works in combat like SetMacroItem or SetMacroSpell), they could make EditMacro work in combat if everything but the first and third argument are nil, they could do lots of stuff.

But they don’t unfortunately. Addons can only do what Blizzard allows them to do. Easily changing #show is not one of those things.

edit: On the topic of custom macro icons, a little-known feature of the game is if you make a 64x64 tga (save with alpha channel; 24+8 or 32-bit encoding, no RLE but these restrictions may be looser now) and create a folder called Icons under Interface (so you have your own Interface\Icons) and save the file there, then the icon will appear in your macro icon choices. It may be mixed in with all the others so hard to find. But you can make all your macros family pictures and stuff.

2 Likes