Well, there is a typo in that code that I just noticed. I edited my previous post to fix it.
However, it looks like SexyCooldown re-shows its frames every time a cooldown starts, so that code won't work anyway. Rather than hiding and showing individual frames, it will probably work better to re-parent them all to the CombatHider frame and just hide and show that, so the hidden/shown state of the inidividual frames doesn't matter:
Code:
-- Add frames to hide in this table:
local FramesToHide = {
"SexyCooldown2Bar1",
}
local CombatHider = CreateFrame("Frame", "MyCombatHider", UIParent, "SecureHandlerStateTemplate")
CombatHider:SetAllPoints(true)
RegisterStateDriver(CombatHider, "visibility", "[nocombat] hide; show")
CombatHider:RegisterEvent("PLAYER_ENTERING_WORLD")
CombatHider:SetScript("OnEvent", function(self, event)
for i = #FramesToHide, 1, -1 do
local frame = _G[FramesToHide[i]]
if frame then
frame:SetParent(self)
tremove(FramesToHide, i)
end
end
end)
I chose the PLAYER_ENTERING_WORLD event because it happens *after* PLAYER_LOGIN so hopefully SexyCooldown has finished setting up its frames by then.