WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   understanding the ESC function in a macro (https://www.wowinterface.com/forums/showthread.php?t=57592)

phrenetic 10-09-19 10:14 PM

understanding the ESC function in a macro
 
hey guys,

i would like to ask for your help, since i'm struggling with quite an easy to implement function for ESC key to close already open frame. Let's cut to the chase, i'm having the following macro:

Code:

/run LoadAddOn("Blizzard_AzeriteEssenceUI")
/run AzeriteEssenceUI:ClearAllPoints()
/run AzeriteEssenceUI:SetPoint("CENTER",0, 0)
/run local b=AzeriteEssenceUI if b:IsShown() then b:Hide() else b:Show() end

basically, it opens the Heart of Azeroth's essence UI (using it just as a shortcut, yeah) and allows you interaction. it's working totally fine, but ESC key doesn't cover this frame. anyone can give me advice? i prefer a macro only, cause it's Xpac related UI, and i really need the knowledge (ex. proper handling of tinsert() function in a macro)

Highly appreciate any answer ;) ty in advance

myrroddin 10-10-19 02:45 AM

Not sure about the ESC to close, but here's a tip to shorten the macro, which you started yet didn't finish.
Code:

/run LoadAddOn("Blizzard_AzeriteEssenceUI")
/run local b=AzeriteEssenceUI
/run b:ClearAllPoints()
/run b:SetPoint("CENTER")
/run if b:IsShown() then b:Hide() else b:Show() end


kurapica.igas 10-10-19 03:21 AM

Try table.insert(UISpecialFrames, "AzeriteEssenceUI"), I can't make sure if it would cause the taint, you can give it a try, it's the shortest way.

I prefer to use the secure button, but it's a little hard to explain.

Lua Code:
  1. /run LoadAddOn("Blizzard_AzeriteEssenceUI");local u = AzeriteEssenceUI;u:ClearAllPoints();u:SetPoint("CENTER", 0, 0);u[u:IsShown() and "Hide" or "Show"](u);if not u.alreadyins then u.alreadyins = true tinsert(UISpecialFrames, "AzeriteEssenceUI") end

Just for short. Well, a full version

Lua Code:
  1. /run LoadAddOn("Blizzard_AzeriteEssenceUI");
  2. /run local u = AzeriteEssenceUI;if not u.alreadyins then u.alreadyins = true tinsert(UISpecialFrames, "AzeriteEssenceUI") u:ClearAllPoints() u:SetPoint("CENTER", 0, 0); end
  3. /run local u = AzeriteEssenceUI;u[u:IsShown() and "Hide" or "Show"](u)

phrenetic 10-10-19 07:38 AM

i really appreciate your time!! work like a charm!

wishin' you free titanforges for life! <3


All times are GMT -6. The time now is 07:10 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI