Thread Tools Display Modes
08-25-09, 02:33 PM   #1
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
One AddOn overriding the other.

How do you make it so an addon has the final say?

I use a flat lua command to hide the main blizzard bar but another addon is making it visible.
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
08-25-09, 02:48 PM   #2
Tristanian
Andúril
Premium Member
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 279
Which frame are you trying to hide ? It may not necessarily be a fault with another addon, but default UI code, can under certain circumstances do this.

If said frame is being shown by another addon, after hiding it, you probably need to hook its Show method, in addition to hiding it. For example:

Code:
hooksecurefunc(<FrameName>, "Show", <YourFunctionName>)
Note that hooking however should be used wisely, since conflicts are also likely to occur, in cases one or more addons are hooking the same function or method. In that particular case, your only hope is to use a hooking library as long as the "offending" addon is also using it.
__________________

Last edited by Tristanian : 08-25-09 at 02:51 PM.
  Reply With Quote
08-25-09, 02:54 PM   #3
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
trying to hide the main menu bar. i em using macaroon so i think macaroon is what is overriding it in the end. If i turn off all addons except my ui's core it functions properly.
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
08-25-09, 03:00 PM   #4
Tristanian
Andúril
Premium Member
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 279
It is true that Macaroon can do that, but isn't there an option to disable such behavior ?
__________________
  Reply With Quote
08-25-09, 03:06 PM   #5
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
hmm good question. i know you can toggle it to show or hide but not sure if you can tell it to not override other things. ill have to dbl check.
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
08-25-09, 03:11 PM   #6
Tristanian
Andúril
Premium Member
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 279
To be perfectly honest, I didn't test it, just had a quick look at the code, but I believe I saw a condition in that part of the code, so I've deduced that in theory, you should be able to turn it off The hook should still work ofc, regardless.
__________________
  Reply With Quote
08-25-09, 06:01 PM   #7
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
Lets say that it was something else. or lets say that one addon had the command to show it and another one had the command to hide it... is their a way to make one addon load before/after the other so that in the end one thing or the other happens?
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
08-25-09, 06:09 PM   #8
Akryn
A Firelord
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 479
Originally Posted by Grimsin View Post
Lets say that it was something else. or lets say that one addon had the command to show it and another one had the command to hide it... is their a way to make one addon load before/after the other so that in the end one thing or the other happens?
Not really. For example, someone could create an OnUpdate script that called :Show on the frame every update. There wouldn't really be any way around that other than overriding the "show" method itself...

Code:
someFrame.Show = function()end
  Reply With Quote
08-25-09, 08:48 PM   #9
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
something has to decide what loads when?
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
08-25-09, 08:50 PM   #10
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
hmm for that mater how does add on loader work? it somehow can stall addons from loading. something has to dictate when an addon loads. maybe a change to the toc file?
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
08-25-09, 09:01 PM   #11
Akryn
A Firelord
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 479
Addons are loaded alphabetically unless they're LOD. What does the order that they load in have anything to do with it though? You're talking about things that happen after loading. Once they're loaded, addons can do things at effectively arbitrary times, so the order that they were loaded doesn't affect which one gets the upper hand if two addons are trying to do opposite things.

Here is some code that will force a frame to stay shown even if the addon loaded on demand 20 minutes after you logged in:

Code:
CreateFrame("frame"):SetScript("OnUpdate", function() someFrame:Show() end)
You could counteract that if you created another frame which updated later in the sequence, but there's no way to guarantee that you'll execute last. The only way to make sure no one else can call frame.Show is to override frame.Show, as I said before.
  Reply With Quote
08-25-09, 09:02 PM   #12
Akryn
A Firelord
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 479
Originally Posted by Grimsin View Post
hmm for that mater how does add on loader work? it somehow can stall addons from loading. something has to dictate when an addon loads. maybe a change to the toc file?
Addons that can be loaded after you log in are called LOD (Load On Demand), you can wiki that. LOD addons are useful, but that won't have any effect on what you're talking about.
  Reply With Quote
08-25-09, 09:10 PM   #13
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
Originally Posted by Akryn View Post
Addons are loaded alphabetically unless they're LOD.
That is a falsehood - UNLESS the fileystem you are using operates in that manner. Under Linux, with the ext3 (or ext4) filesystem, using "!" as the first character of the file name has no effect on load order.
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of NPCScan and many other AddOns.
  Reply With Quote
08-25-09, 10:38 PM   #14
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
so in other words.... its just random everytime the ui is loaded? so if one addon says hide the main menu and the other says show it it could change each time you load up? huh well that explains a lot....
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
08-26-09, 01:28 AM   #15
Tristanian
Andúril
Premium Member
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 279
Originally Posted by Grimsin View Post
so in other words.... its just random everytime the ui is loaded? so if one addon says hide the main menu and the other says show it it could change each time you load up? huh well that explains a lot....
No, it's not random at all. For example, if an addon is set to let's say hide the MainMenuBar each and every time on PLAYER_ENTERING_WORLD, this means, said frame will be hidden, regardless of its current state, whenever that event fires (pretty much every time you get a loading screen).

It depends on when each addon is executing its code and why its doing it. I'm afraid that only the author can reliably answer those questions though.
__________________

Last edited by Tristanian : 08-26-09 at 01:30 AM.
  Reply With Quote
08-26-09, 05:58 AM   #16
Akryn
A Firelord
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 479
Originally Posted by Grimsin View Post
so in other words.... its just random everytime the ui is loaded? so if one addon says hide the main menu and the other says show it it could change each time you load up? huh well that explains a lot....
The load order is irrelevant, not random. Addons can show and hide things at arbitrary times. What is important is not when the addons load, but when they are coded to show/hide the frame.

Last edited by Akryn : 08-26-09 at 06:03 AM.
  Reply With Quote
08-26-09, 06:02 AM   #17
Akryn
A Firelord
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 479
Originally Posted by Torhal View Post
That is a falsehood - UNLESS the fileystem you are using operates in that manner. Under Linux, with the ext3 (or ext4) filesystem, using "!" as the first character of the file name has no effect on load order.
Ah good information. Well -- alphabetical as defined by a sort that's not done by WoW and might vary, then.
  Reply With Quote
08-26-09, 08:42 AM   #18
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
okay so that still leaves something undetermined and im positive that something decides what goes first because in testing some of this ive noticed that it dosnt bounce back and forth so it is for sure loading in an order and its always the same order.

If two addons they both use a on PLAYER_ENTERING_WORLD to fire the command but one addon says MainMenuBar:Hide() and the other one says Show! what determines which one is going to fire first. something has to be because im 99% sure it does not actually fire simultaneously. that theoretically would result in an error not the window hiding and then reappearing or vice verse which is how it reacts currently.

Another example is the print to chat msgs from every addon. notice they always fire up in same order the same addon prints its msg last every time. something is dictating that. the same thing im sure that dictates what addon has the last laugh on the on PLAYER_ENTERING_WORLD trigger.
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
08-26-09, 12:02 PM   #19
Akryn
A Firelord
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 479
I believe that events fire for frames in the order that the frames registered them (don't quote me on that). But again, it is completely irrelevant unless you only care about addons that you know for sure only call Hide in response to the same event, and only once.
  Reply With Quote
08-26-09, 12:35 PM   #20
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
okay so what determines what registers frames first? the .toc? is it then alphabetical maybe? and of course once in an lua file or xml file is it then based on what line number a frames create tag is on? im almost positive that once in the xml or lua it is definitely controlled by line number or what comes first in the code if you dont have line numbers on.... i have seen other evidence of this.

is it the load sequence then of the .toc that controls what .lua's and .xmls load first? i do not think that it is the folder name. other wise smartbuff would not always load last.
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » One AddOn overriding the other.


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