Originally Posted by Saiket
Your OnEvent function doesn't have "self" or "unit" arguments. Change line 14 to this and it should work:
lua Code:
f:SetScript('OnEvent', function(self, event, unit)
|
Hmm, nop didn't work
LUA Code:
local f = CreateFrame('Frame')
f:RegisterEvent("UNIT_SPELLCAST_SENT")
f:RegisterEvent("UNIT_SPELLCAST_START")
f:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START")
f:RegisterEvent("UNIT_SPELLCAST_CHANNEL_STOP")
f:RegisterEvent("UNIT_SPELLCAST_STOP")
f:RegisterEvent('UNIT_SPELLCAST_FAILED')
f:RegisterEvent('UNIT_SPELLCAST_INTERRUPTED')
f:RegisterEvent('UNIT_SPELLCAST_DELAYED')
f:RegisterEvent('UNIT_SPELLCAST_CHANNEL_UPDATE')
f:RegisterEvent('UNIT_SPELLCAST_CHANNEL_INTERRUPTED')
f:SetScript('OnEvent', function(self, event, unit)
if unit == "player" or unit == "target" or unit == "focus" or unit == "pet" then
if self.Castbar then
if event == "UNIT_SPELLCAST_START" or event == "UNIT_SPELLCAST_CHANNEL_START" then
UIFrameFadeIn(self.Castbar, 0.8, self.Castbar:GetAlpha(), 1)
elseif event == "UNIT_SPELLCAST_STOP" or event == "UNIT_SPELLCAST_SENT" or event == "UNIT_SPELLCAST_FAILED" or event == "UNIT_SPELLCAST_INTERRUPTED" or event == "UNIT_SPELLCAST_CHANNEL_STOP" then
UIFrameFadeOut(self.Castbar, 0.8, self.Castbar:GetAlpha(), 0.2)
end
end
end
end)