Need help disabling an addon frame when out of combat
I apologize if this isn't the right place to post this, I wasn't sure if I should post here or under AddOn Search/Requests. I've been trying to modify this script and I've been running into a few issues. While my chosen frame is disabled once combat is finished, it doesn't disable the frame when I log in until after I exit combat. This is my modified version.
Lua Code:
When logging in I get the following error: Lua Code:
After speaking with some others I've come to the conclusion that this most likely happens because this script is loading before Pitbull (the addon that contains the frame I'm hiding). My best guess would be that the original author didn't have this issue since he was hiding blizzard frames. I'd assume those load before everything else. It seems like "ADDON_LOADED" may be able to make this script load after Pitbull, but I'm not quite sure how to implement it. I assume that this error is tied together with the reason that my frame isn't hiding prior to exiting combat. Lastly, in the forum post where I originally found this script (the one linked at the top) the author adds a feature that fades the frames in and out. If possible, I'd like to add that feature to this script but again I'm not sure how to go about doing that. I know that Pitbull has a built in feature to control fading in and out of combat, but it doesn't prevent the frame from being clicked. While it does have a "click through" option, that applies to all frames and I don't want that. To sum things up: 1. I'd like my script to disable the "PitBull4_Groups_Party" frame while not in combat but an error is preventing this on login. 2. I'd like the frame to fade in and out prior to being disabled. This is the first time I've tried to do something like this and I'm definitely in over my head. I've looked/asked around and I've tried to do my best to figure things out, but I've been at this for a day or two with no success. Most of the material I've been looking at has been from WoW Interface so I thought it would be a good idea to ask here. Any help would be greatly appreciated because I'm at a loss! |
why don't you use pitbull's combat fader instead or is this feature gone?
|
ADDON_LOADED event has one parameter .. the name of the addon ..
So, first, identify the precise addon name for Pitbull . Then in the if statement for testing whether the addon loaded is pitbull .. do your pitbull required functionality then. This is an example from one of my nUI plugins. I check for both nUI and my own addon.. If this was a plugin that included a third addon window I would check for that as well and make sure all required addons are loaded once the plugin addon is loaded .. Lua Code:
|
Quote:
Quote:
Thank you for the example. I'm going to mess around with this and see if I can make something work. If you don't mind me asking, at which point in this script is it checking for your own addon? |
A shorter version would be telling wow to load your addon after the addon you depend on.
https://wow.gamepedia.com/TOC_format OptionalDeps String - A comma-separated list of addon (directory) names that should be loaded before this addon if they can be loaded. Code:
## OptionalDeps: someAddOn, someOtherAddOn |
Quote:
Lua Code:
Does this mean that it isn't related to the load order? From my understanding a nil value means that it doesn't exist for it to use, but the frame is clearly there when I log in. If it isn't load order I'm lost. T_T |
I dont use Pitbull but I see that it has a modular setup.
Looking at the code I'd guess it is created on startup. But only when the group is enabled (dont know what that means in this context). In the Main.lua the function OnProfileChanged calls MakeGroupHeader which is located in GroupHeader.lua . So my guess would be that the group 'party' is not enabled when you try to access it. Lua Code:
|
Finally I made some progress. I'm pretty sure I made things a ton harder than they should have been, but it's nice to go from knowing absolutely nothing to seeing something work. As I mentioned above, I added the ## OptionalDeps: PitBull4 to my .toc but it didn't change anything. At first I thought that I was wrong about the nil value error, but then I wondered if Pitbull needed some time to load its frames after its own activation. I did a little poking around and figured out how to implement C_Timer.After. Stalling the script a little seems to have done the trick. Now I just need to fix it from reappearing when I change specs / implement some kind of fader.
|
Keep in mind that some changes cant be made in combat. That means the change has to be made before you receive the combat event. So when you reload in a combat situation your script might fail because it tries it too late.
|
Quote:
Edit: Luckily after some testing it seems that reloading during combat doesn't interfere with with the script. |
Not sure. I'm not good with the secure handling of scripts.
I'd either track down exactly the events that lead to the construction of the frame and copy them or I'd add checks if the frame exists before I use it which is always a good idea when you dont own a frame. Lua Code:
|
I'm not sure that I went about this the best way, but here's what I've managed to get so far. I'm sure something will go wrong, but in the meantime this script seems to disable the frame at login, after combat has ended and after I change talents (frame only activates for holy spec).
Lua Code:
Now I need to figure out how to make the frame fade before it goes away. |
I'm currently trying to use UIFrameFade to hide the frames. UIFrameFadeIn works fine but when I try to use iUIFrameFadeOut I get an ADDON_ACTION_BLOCKED error. I'm not sure why I can hide the frame but not fade it out. Any suggestions would be appreciated.
|
Quote:
Blizzards fading has caused taints in the past, maybe the problem still exists. |
All times are GMT -6. The time now is 05:03 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI