Thread Tools Display Modes
09-26-20, 01:49 AM   #1
jlrm365
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Oct 2007
Posts: 113
Question make better / BuffFrame:Hide();

I found a brilliant UI addon, but it still shows the auras / buffs in the top right corner.
I'm not a coder, but read through the LUA of a few addons and found:
Code:
"BuffFrame:Hide();"
I was able to make that work with /run BuffFrame:Hide();
It seemed smart to put it into an addon, so came up with:
Code:
function events:PLAYER_ENTERING_WORLD()
	BuffFrame:Hide();
end
It was put into the correct toc and lua configuration, so that wasn't the problem.
Simply changing the lua to just that one thing - to just "BuffFrame:Hide();" (no more lines or words) - made it work.

The thing is that I'm sure that can't be the slickest / most friendly to the game way to do it.
I'd simply like to hide that Buff frame utterly and always. What would be the simplest way to use "BuffFrame:Hide();" to do so?

Thanks!
  Reply With Quote
09-26-20, 04:22 PM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
I'd just run BuffFrame:Hide() by itself. There really isn't a need to wait for an event to fire.
It really depends on the frame and what its original code does. Lots of frames show and hide themselves. Fortunately, BuffFrame does not.



-= Off-Topic =-
To respond to an event, you need to create a frame to listen for it. For readability, many people use a generic handler to redirect events to different functions stored in the frame's table.

Example:
Lua Code:
  1. local EventFrame=CreateFrame("Frame");--    Create our frame and assign it to a local variable called EventFrame
  2. EventFrame:RegisterEvent("PLAYER_ENTERING_WORLD");--    Register our frame to listen for PLAYER_ENTERING_WORLD
  3. EventFrame:SetScript("OnEvent",function(self,event,...)--   Dynamic function to act as our script handler
  4.     if self[event] then self[event](self,event,...); end--  If we have a method stored in the frame's table, run it
  5. end);
  6.  
  7. function EventFrame:PLAYER_ENTERING_WORLD(event,...)
  8. --  Do Stuff
  9. end

I personally prefer one of the more efficient ways of handling events, but this is explaining what you've seen others do.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 09-26-20 at 04:25 PM.
  Reply With Quote
09-26-20, 05:22 PM   #3
jlrm365
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Oct 2007
Posts: 113
Originally Posted by SDPhantom View Post
I'd just run BuffFrame:Hide() by itself. There really isn't a need to wait for an event to fire.
The response and extra info is appreciated.
I'll do as suggested, there, and keep the "addon" as it is.
Thanks.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » make better / BuffFrame:Hide();

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