With some help on reddit i got it to work. Code can be found here
Original Post
First I'm apologise if "Addon Help" would be the better subforum, but because Stuf Unit Frames didn't provide the features I want and I have some general questions too, I choose "Lua Code Discussion".
My Problem:
I want to archive that the PlayerFrame provided by Stuf Unit Frames hides when I'm
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")
hideAnything:RegisterEvent("PLAYER_ENTERING_WORLD");
local function HideFrame(self) -- Insecurely hide out of combat if shown
if not InCombatLockdown() then self:Hide() end
end
local function eventHandler(self, event, ...)
if (IsAddOnLoaded("Stuf")) then
hideAnything:SetFrameRef("PlayerFrame", Stuf.units.player)
Stuf.units.player:HookScript("OnShow", HideFrame)
end
hideAnything:SetAttribute("_onstate-combat", [=[ -- Securely toggle visibility in combat
if newstate == "show" then
self:GetFrameRef("PlayerFrame"):Show()
else
self:GetFrameRef("PlayerFrame"):Hide()
end
]=])
RegisterStateDriver(hideAnything, "combat", "[combat] show; hide")
end
hideAnything:SetScript("OnEvent", eventHandler)
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.
Sincerely TrueAtraz
English isn't my native language, so I hope it isn't to awfull to read / understand
0
With some help on reddit i got it to work. Code can be found here
Original Post
First I'm apologise if "Addon Help" would be the better subforum, but because Stuf Unit Frames didn't provide the features I want and I have some general questions too, I choose "Lua Code Discussion".
My Problem:
I want to archive that the PlayerFrame provided by Stuf Unit Frames hides when I'm
and that the TargetTargets(?) Frame hides when
My Try:
Because I have no experience in LUA or creating an WoW Addon I googled and found this thread LUA: Hide unit frames out of combat.
With the Information and LUA Snippet in that thread and the rest i found via google i created this code:
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 modifed that to my parameters I use in bartender
... it didn't worked at all :(
General Questions:
Questions to my Problem:
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.
Sincerely TrueAtraz
English isn't my native language, so I hope it isn't to awfull to read / understand