View Single Post
02-27-15, 10:42 PM   #7
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
It doesn't work because your cooldown frame is (a) not parented to your frame and (b) not inheriting from the correct (or any) template. Your code is also really badly formatted; addons aren't macros, and space isn't limited, so you should really use good spacing, proper indentation, and meaningful variable names:

Code:
local t = CreateFrame("Frame")
t:SetPoint("RIGHT", TargetFrame, 12, 12)
t:SetSize(30, 30)

t.cd = CreateFrame("Cooldown", nil, t, "CooldownFrameTemplate")
t.cd:SetAllPoints(true)

t.icon = t:CreateTexture(nil, "ARTWORK")
t.icon:SetAllPoints(true)
t.icon:SetTexture("Interface\\Icons\\spell_holy_divinepurpose")

t:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
t:Hide()

local PLAYER_NAME = UnitName("player")
local function Hide() t:Hide() end

t:SetScript("OnEvent", function(self, event, _, combatEvent, _, _, sourceName, _, _, _, _, _, _, spellID)
	if sourceName == PLAYER_NAME and combatEvent == "SPELL_AURA_REMOVED" and spellID == 126705 then
		self:Show()
		CooldownFrame_SetTimer(self.cd, GetTime(), 45, 1)
		C_Timer.After(45, Hide)
	end
end)
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote