Show/Hide Custom Frame in Combat Lockdown
Hello everyone, Henbe here. I am quite inexperienced in lua and coding in general, please help me understand how to show/hide frames in secured enviroment. I have a little piece of code that creates a frame with texture and shows/hides on toggling bags. Outside of combat it works just fine, but I get an error while in combat.
Lua Code:
|
I handle user interaction using the pre and post combat events.
PLAYER_REGEN_DISABLED PLAYER_REGEN_ENABLED When the event DISABLED is triggered this means you are about to initiate combat so do what you need to stop people from using your frames during this time. Either disable buttons or hide the frame etc. When the event ENABLED is triggered combat is finished and you can now allow them to interact with the frames. Enable buttons or show the frame etc. |
Got it, but how do I show/hide this frame during combat? If I do it, let's say, to create bags layout, I might want to open bags in combat and use potion I forgot to put on action bars.
|
This is how nUI handles clicking a button during combat ( it switches display panels linked to the button ), I only maintain the addon so not all elements of the addon are fully understandable to me but I have dabbled with secure frames to fix action button issues so some of this does make some element of sense to me now. Hopefully, reading through it will give you something to help you with your own button.
Lua Code:
Elsewhere in the code the panel list is also setup in secure mode Lua Code:
|
But, seeing as you are attempting to deal with custom bag management, you might want to take a look at some of the others out there as they may have added secure frame management in their code.
One that sounds plausible ( I haven't checked the code ) is : https://www.wowinterface.com/downloa...agsNivaya.html |
Wait, is your FB2 frame just showing a texture? Why are you creating it as a secure frame? It doesn't do anything, it's just an image, right? Take that out and everything should be fine.
|
Quote:
|
If the frame isn't trying to perform a secure action requiring a secure template then you can do what you like (protected actions not withstanding) with it.
Without the secure template, the OP could just parent the frame to ContainerFrame1 and leave out the hook altogether. |
Hmm .. I'm sure it was something that was said at one point or other but maybe a misunderstanding ... the secure system was mystical in my early addon days and alot of the old info has stuck in my brain :) Thanks .. learning something new every day.
wowpedia does have a note about buttons ( which isn't the issue henbe would have as the button hides/shows another frame ) 'Protected function I found that Frames of type Button can't call this method if the player is in combat.' https://wowpedia.fandom.com/wiki/API_Region_Show |
A quick example if anyone wants to try.
Code:
local f = CreateFrame("Button", "Fizz_TargetDummy", UIParent, "SecureUnitButtonTemplate") Edit: Silly VM wouldn't update the code section. |
Yep, so long as the button isn't doing anything secure.
But the OP only had a regular frame with a texture object. |
Sorry for a long reply delay. My poor knowledge let me down, because I don't know a whole lot about secure actions, templates and taint.
I am making bags layout and actually it does perform secured action on inventory slots(use consumables, hearthstones, etc). It is not as fancy as super-indepth addons, but does a trick, except a few things and showing/hiding in combat is one of them. I have edited an original post with full code. Dealing with combat lockdown is main priority but any tip will be very appreciated. Sorry for a very misleading OP. |
I not sure what the intended final outcome is over and above what can be achieved with the regular bags or, whether part of what you are doing is because you're figuring things out so, this is a guess at a possibilty of what you might be looking for (all your code included with bits commented out. Based on Default UI bags no bag addons).
Lua Code:
Edit: Maybe you're looking to do somthing similar to AutoBar? |
Quote:
|
All times are GMT -6. The time now is 12:39 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI