Looking to make a macro with universal #show

I would like to make a macro which will show different abilities in the #showtooltip

I use the /click function with several different characters to use their mounts, but they each use different mounts so the tooltips are not accurate.

It looks like this:

   #show ....?
   /click [combat]MultiBar7Button3
   /click [mod][nocombat,noadvflyable] MultiBar7Button1
   /click [nomod,advflyable]MultiBar6Button1
   /dismount [noflying,mounted][flying,mod:shift]

It clicks a different button depending on the conditionals, either a combat ability or a mount, and each character has different abilities and mounts.

I have tried “#show MultiBar6Button1” and it does not work. I am looking for a way to dynamically show the tooltip for whatever is in a given frame id

Please let me know if you know a way to do this, thanks.

I’d recommend getting the LiteMount addon.

In the meantime, here’s an optimized version of the macro so you’ve got more space for the show shenanigans (that said I think it’ll take more space than a macro allows).

#show
/click [combat]MultiBar7Button3; [mod][noadvflyable] MultiBar7Button1; MultiBar6Button1
/dismount [noflying,mounted][flying,mod:shift]

Thanks, but I am pretty much satisfied with how the macro functions … .I just need help with the tooltip

#show doesn’t do a tooltip, it just does the macro icon.

On the assumption you meant #showtooltip, a universal one that can show the tooltip of /clicked buttons would have to:

  • Parse macros for the first line to meet the criteria. (SecureCmdOptionsParse each line possibly)
  • If it’s not a /click, then you can leave and let the UI handle the tooltip/texture.
  • If it’s a /click, then inspect the button to determine what action it has. (Generally a button.action or an action attribute)
  • Determine whether this button has an item or spell. (GetActionInfo)
  • If it’s a pet, equipset, other macro, or anything other than an item or spell (toys and mounts are fine) that needs a tooltip, things get very complicated at this point. (You will need to do some hooks on the action button to replace its tooltip as you replace its texture; possibly going to other macros if the button is another series of /clicks.)
  • If it’s an item or spell, SetMacroItem or SetMacroSpell to the macro. This can be done in combat.

If you’re fine with just #show things are a bit simpler:

  • Parse macros for the first line to meet the criteria.
  • If it’s not a /click, let the UI handle the icon.
  • If it’s a /click, then inspect the button to determine what action it has. (Generally a button.action or an action attribute)
  • GetActionTexture the action of the button.
  • SetTexture to the action of the intended macro.

In both cases you’ll need to override the default UI’s SetTexture, possibly with hooksecurefunc or something. And it ignores the ability to /click secure buttons with non-action attributes, which complicates things a bit more.

Or instead of all of the above, you can do:

#showtooltip [combat] Spell/Item 1; [mod][noadvflyable] Spell/Item 2; Spell/Item 3
/click [combat]MultiBar7Button3; [mod][noadvflyable] MultiBar7Button1; MultiBar6Button1
//etc

Of course it won’t accurately reflect what each action button would do if they have their own conditions, but it will give some feedback to which button you’re going to use when the macro is hit.

1 Like

The best overall approach might be to move all the castable abilities, things that could be shown by “#show” into the main macro and save the click buttons for anything you don’t need to be on the icon.

#show would probably be enough, but I don’t know how to parse macros or do any of the other technical suggestions. My knowledge is limited to standard macro commands and conditionals, not scripting.

I would like to be able to reference specific icons, rather than spells if you understand my meaning. If I add a macro line “#show Devastate” it will only work when I am a Prot warrior, it won’t work in Fury or when I am on any other character. I would like a way to point to the icon/artwork for devastate (or any spell) rather than using the spell name itself. Because the spell name will only work on certain classes.

Is there an easy way to call upon a specific artwork asset so I can add it to #show?

Thanks

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

First of all, thank you for your effort, it is appreciated.

I tested the addon and it does exactly what you said. Now that I see the function, it makes me wonder if it is possible to update the icons based on the abilities placed in a MultiBar?

The macro I would like to have would display the following #showtoolip or #show

[combat] Show the icon in MultiBar7Button3
[flyable,nocombat] Show the icon in MultiBar7Button2
[advflyable,nocombat] Show the icon in MultiBar7Button1

Is it possible to update the icons dynamically with an addon? I am not trying to make work for you, so please feel free to just decline :slight_smile: If it is not something that is easy to do, I will just use the macro as it is without an icon.

Basically the goal is to have a macro that multiple characters can use by slotting different abilities in Multi Bar 7, which is off to the side and not used much. If it works well, I think I might use the same technique for other macros.

Thank you again for your time

Possible, yes. How? It depends. There’s specific details still missing like what these other action buttons contain and how it differs on alts if it does. Maybe a GetTexture of the other ones if state drivers happen after the UI is done doing its stuff. Maybe a per-character condition.

It will probably be up to someone else to modify that if any. I have a busy weekend coming up.

I understand, I will just use what I have. Thanks for your help

you do Elune’s work my new Gnome friend. I’ve been searching for awhile for this solution. I thank thee.