With the Information and LUA Snippet in that thread and the rest i found via google i created this code:
local hideAnything = CreateFrame("FRAME", nil, nil, "SecureHandlerStateTemplate")
local function HideFrame(self) -- Insecurely hide out of combat if shown
if not InCombatLockdown() then self:Hide() end
local function eventHandler(self, event, ...)
if (IsAddOnLoaded("Stuf")) then
hideAnything:SetAttribute("_onstate-combat", [=[ -- Securely toggle visibility in combat
if newstate == "show" then
RegisterStateDriver(hideAnything, "combat", "[combat] show; hide")
The code works but only in combat and I didn't found a solution for my "out of combat" problems.
Also in the linked thread i found that i could only use this:
I work in the "PLAYER_ENTERING_WORLD" Event because I couldn't find a solution how I execute my Code AFTER Stuf Unit Frames loaded and the frames I access aren't nil anymore. Is there a better way?
In the SetAttribute Method is the state(?) "_onstate-combat" used, but I didn't find ANY HELPFUL documentation about this state. wowprogramming.com refers to SecureTemplateReference, but "_onstate-combat" isn't listet there.
Questions to my Problem:
How do I accomplish the tasks I want?
I appreciate any tips and hints and would prefer them, because i would like to accomplish this mostly by myself, but I woudln't mind a complete solution.
Hope someone can help me.
English isn't my native language, so I hope it isn't to awfull to read / understand