Thread Tools Display Modes
01-06-15, 06:59 AM   #1
MaloW
A Defias Bandit
Join Date: Dec 2014
Posts: 3
Event for arena scoreboard opening?

Heya, I'm pretty new to developing addons, but I'm currently working making an improved scoreboard for arena games, so I'm thinking I'll hide the default scoreboard that pops up and open my own instead. For this to work however I need to be able to listen to an event or something like that for when the scoreboard opens. I've scrolled through the event list but was unable to find one that would fit for me. I've identified the default scoreboard frame as WorldStateScoreFrame, so I was thinking, is there maybe some way to listen for an event when :Show() is called on that frame or something? Or does someone have any other idea?
  Reply With Quote
01-06-15, 08:23 AM   #2
Banknorris
A Chromatic Dragonspawn
 
Banknorris's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 153
function New_Arena_Scoreboard(self)
--do something
end

WorldStateScoreFrame:HookScript("OnShow",New_Arena_Scoreboard)




.

Last edited by Banknorris : 01-06-15 at 08:27 AM.
  Reply With Quote
01-06-15, 08:55 AM   #3
MaloW
A Defias Bandit
Join Date: Dec 2014
Posts: 3
Originally Posted by Banknorris View Post
function New_Arena_Scoreboard(self)
--do something
end

WorldStateScoreFrame:HookScript("OnShow",New_Arena_Scoreboard)
.
Awesome, thanks, works great!
A follow-up question though, I tried to use the same method to hide the blizzard arena frames, ArenaPrepFrame1 for example, but getting the error that it is nil. WorldStateScoreFrame seems to always be available and never nil, so hooking like above works fine, but how would one do this for a frame that is nil at times? Is there some smart way to hook like this? Or would I have to for example listen to addon loaded events and hide them once they are loaded?
  Reply With Quote
01-06-15, 09:08 AM   #4
Banknorris
A Chromatic Dragonspawn
 
Banknorris's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 153
Yes, assuming a frame is nil until an addon is loaded (but exists once the addon is loaded) you can put your hooking script on an "ADDON_LOADED" event handler. If the frame is created after an addon is loaded, by not immediately, you can use hooksecurefunc() API to hook the function that creates the frame.
  Reply With Quote
01-06-15, 09:33 AM   #5
MaloW
A Defias Bandit
Join Date: Dec 2014
Posts: 3
Originally Posted by Banknorris View Post
Yes, assuming a frame is nil until an addon is loaded (but exists once the addon is loaded) you can put your hooking script on an "ADDON_LOADED" event handler. If the frame is created after an addon is loaded, by not immediately, you can use hooksecurefunc() API to hook the function that creates the frame.
Alright, thanks again!
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Event for arena scoreboard opening?


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