LUA: Hide default frames OOC and show if target
Hello guys.
I need some help with the following. Here's what I need it ( the code ) to do:
Lua Code:
|
You have your target condition as a completely separate 4th argument for RegisterStateDriver, which only takes 3 arguments.
Lua Code:
You need to combine the macro conditions into one string that handles both situations. Lua Code:
The other problem is that you're hooking all of their OnShow scripts to hide the frame 'if not InCombatLockdown() or not UnitExists("target")', which means it will always attempt to hide the frame if it's shown out of combat. It should use "and" instead of "or" since you can't securely hide the frames in combat that way, however it should not be necessary to hide any of the frames this way if the state driver is working, so you might as well remove the hooks. |
Thanks for answering. I'll see what I can do later... need to go and cook something fine :)
Allright, just seen your edit. I'll try that then. I'll report back later. Thank you. |
You might also consider reparenting all of these frames to frame f and simply hiding and showing that rather than handling them separately, that way you won't have to worry about them being shown when they're not supposed to be.
If you choose to do that you'll want to make f a child of UIParent to keep the scales consistent. |
The unitframes are working fine now. If there's a target and in combat, they are showing. Extactly what I wanted.
Lua Code:
The second thing I wanted to try is to show the minimap only if in combat. This is what I got so far: Lua Code:
This is what happens after a /reload: Out of combat -> Minimap is shown. Entering combat -> Minimap is shown. Leaving combat -> Minimap is hidden. Any tips on how to hide it from the start ( login / reload )? |
Quote:
|
I tried so many things, it just won't work... still trying..
I even added commands and stuff, everything's working fine but the hide on login... Tried with ADDON_LOADED, PLAYER_ENTERING_WORLD and PLAYER_LOGIN. |
I don't know what you tried, but this works fine for me, at least as far as I understand what you're asking.
Lua Code:
|
Got everything working now. I did the same thing to hide the BuffFrame and it works too.
Thanks for your help, I appreaciate it. :) |
All times are GMT -6. The time now is 02:39 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI