Thread Tools Display Modes
02-10-15, 09:46 PM   #1
wallst
A Murloc Raider
Join Date: Feb 2015
Posts: 5
ICD Tracking script

Hi, help modify this script. Need hide icon frame when cd timer expired
Lua Code:
  1. local t=CreateFrame("FRAME")
  2. t:SetPoint("RIGHT",TargetFrame,12,12)
  3. t:SetSize(30,30)
  4. t.c=CreateFrame("Cooldown","cd1")
  5. t.c:SetAllPoints(t)
  6. t.t=t:CreateTexture(nil,"BORDER")
  7. t.t:SetAllPoints()
  8. t.t:SetTexture("Interface\\Icons\\spell_holy_divinepurpose")
  9. t:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
  10. t:Hide()
  11.  
  12. t:SetScript("OnEvent", function(...)
  13. local b,_,_,e,_,_,_,_,_,_,l = select(4, ...)
  14. if (e == UnitName("Player") and (b=="SPELL_AURA_REMOVED")and l==126705)
  15. then t:Show() CooldownFrame_SetTimer(cd1,GetTime(),45,1)
  16. return
  17. end
  18. end)
  Reply With Quote
02-11-15, 09:51 PM   #2
sticklord
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: Aug 2014
Posts: 57
Try this:
Lua Code:
  1. local t=CreateFrame("FRAME")
  2. t:SetPoint("RIGHT",TargetFrame,12,12)
  3. t:SetSize(30,30)
  4. t.c=CreateFrame("Cooldown","cd1")
  5. t.c:SetAllPoints(t)
  6. t.t=t:CreateTexture(nil,"BORDER")
  7. t.t:SetAllPoints()
  8. t.t:SetTexture("Interface\\Icons\\spell_holy_divinepurpose")
  9. t:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
  10. t:Hide()
  11.  
  12. t:SetScript("OnEvent", function(...)
  13. local b,_,_,e,_,_,_,_,_,_,l = select(4, ...)
  14. if (e == UnitName("Player") and (b=="SPELL_AURA_REMOVED")and l==126705)
  15. then t:Show() CooldownFrame_SetTimer(cd1,GetTime(),45,1)
  16. C_Timer.After(45, function() t:Hide() end)
  17. return
  18. end
  19. end)
  Reply With Quote
02-12-15, 02:16 PM   #3
wallst
A Murloc Raider
Join Date: Feb 2015
Posts: 5
sticklord thanks!
  Reply With Quote
02-26-15, 10:12 AM   #4
wallst
A Murloc Raider
Join Date: Feb 2015
Posts: 5
This script don't work after 6.1 patch. What happened ?
  Reply With Quote
02-26-15, 05:14 PM   #5
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
What, exactly, "doesn't work"?
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
02-27-15, 05:22 PM   #6
wallst
A Murloc Raider
Join Date: Feb 2015
Posts: 5
Originally Posted by Seerah View Post
What, exactly, "doesn't work"?
Lua Code:
  1. then t:Show() CooldownFrame_SetTimer(cd1,GetTime(),45,1)
  2. C_Timer.After(45, function() t:Hide() end)
  Reply With Quote
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
02-28-15, 09:38 AM   #8
wallst
A Murloc Raider
Join Date: Feb 2015
Posts: 5
Phanx, your code doesn't work too.
  Reply With Quote
02-28-15, 11:36 PM   #9
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
If you want any more help you're going to have to be more specific than "doesn't work". Where are you putting the code? How do you know it's being loaded? Does it raise any error messages? If so, what are they? If not, do you have any kind of error display enabled? What exactly are you doing, and what do you think the addon should be doing in response to that? What is it doing instead?
__________________
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

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » ICD Tracking script

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off