Quantcast understanding the ESC function in a macro - WoWInterface
Thread Tools Display Modes
10-09-19, 10:14 PM   #1
phrenetic
A Defias Bandit
Join Date: Jan 2007
Posts: 2
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
  Reply With Quote
10-10-19, 02:45 AM   #2
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,063
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

Last edited by myrroddin : 10-10-19 at 02:46 AM. Reason: No need to have X, Y offsets if you want dead center
  Reply With Quote
10-10-19, 03:21 AM   #3
kurapica.igas
A Flamescale Wyrmkin
Join Date: Aug 2011
Posts: 118
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)
  Reply With Quote
10-10-19, 07:38 AM   #4
phrenetic
A Defias Bandit
Join Date: Jan 2007
Posts: 2
i really appreciate your time!! work like a charm!

wishin' you free titanforges for life! <3
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » understanding the ESC function in a macro

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off