How to ClearTarget() out of combat now?

#0 - Dec. 6, 2006, 9:29 p.m.
Blizzard Post
You know how you sometimes spam the Escape key to (close windows, stop a cast, kill the chat window, whatever), but then you hit Escape one too many times and the main menu pops up? And then you can't do anything until you hit Escape one more time to clear it?

I saw this posted here months ago and have been loving it ever since:

i = CreateFrame("frame", "MyNeverCloseFrame");
i:SetScript("OnHide", function()
this:Show();
ClearTarget();
end);
tinsert(UISpecialFrames, "MyNeverCloseFrame");

This rocks. It lets me spam the Escape key in panic and get back to a clear playing state, but never brings up the main menu because there's always a window "shown".

Now, of course, it breaks with the restricted-action-ignore-or-die error. I know it's the ClearTarget() line, because I can comment that out and then it all works.

I'm told that all of my calls to CreateFrame() now have to have some other blizzard secure frame name in them in order for *any* kind of frame manipulation, whether in combar or out, and from my experiences since yesterday this seems to be true. But the wowwiki is offline and the two stickied "Guide to <...>" threads don't have anything beyond a brief overview yet. I wasn't lucky enough to get a Beta invite so I don't know how any of this works.

Anybody know how to change that little recipe there so it works again? It doesn't have to work in combat cuz nothing's going to work in combat anymore, but if I could just get it working around the bank and AH then it'd be really convenient.
#6 - Dec. 7, 2006, 9:53 p.m.
Blizzard Post
Did you try this?
/cleartarget

In the Burning Crusade release, you'll also be able to use a target unit of "none" in the secure action buttons.
#24 - Dec. 8, 2006, 10:39 p.m.
Blizzard Post
Once you create your secure action button, you can do this:
button:SetAttribute("type", "macro");
button:SetAttribute("macrotext", "/cleartarget");

Then, clicking on the button will execute this macro, in this case clearing the target.

You can even set a key binding for it:
SetBindingClick("Z", "ButtonName");
SaveBindings(GetCurrentBindings()); -- not tested, I think that's it though.

Also, in 2.0.2, you'll be able to set the target action to the unit "none" to clear the target.