Menu Macros Not Working (In Combat)

I use simple macros like /run ToggleQuestLog(); in combination with OPIE to replace the need for keybindings and buttons to access the game menus. It works fine, except in combat, where the menu fails to open and I get the message “Interface Action failed because of an AddOn”. I know for a fact it isn’t because of any Addons, because I disabled all of them 1 by 1 to try to isolate the cause and none were responsible. The message persists even with all AddOns disabled when I type the macro manually or use it after setting it on my action bar – again, only when I’m in combat. Is this working as intended? And/or is there something I can do to modify my macros to get around this happening?

They’re all pretty similar, /run ToggleGuildFrame(); /runToggleCollectionsJournal(); etc.

In particular I was wondering if it is possible to set a macro…to use a keybind. As in an established keybind from the official menu, for example a Macro that presses “J” and opens the Quest Log which corresponds to J in your Blizzard keybindings.

I’m not sure what the right answer is here, but I think this works:

/run if WorldMapFrame:IsVisible() then WorldMapFrame:Hide() else WorldMapFrame:Show() end

This means your code is calling a function that is protected so only Blizzard’s code can use it in combat. The error will say “addon” even if the code that caused it was in a macro with /run.

I think the easiest way to get around this would be with /click.
For example to toggle the guild UI use /click GuildMicroButton
or for the quest log /click QuestLogMicroButton

This should work for any button that was given a name when it was created.
To find the name use /fstack and mouseover the button. That will give you a list of all the UI elements under the cursor.

If instead of names you get UIParent followed by uninteligible numbers and letters try

/console fstack_preferParentKeys 0
2 Likes

Yes, ShowUIPanel() was combat protected because apparently it was somehow abused for kickbotting
https://www.townlong-yak.com/framexml/8.2.0/UIParent.lua#3200

This works, simple and easy to implement too, appreciate the replies.