WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Legion Beta archived threads (https://www.wowinterface.com/forums/forumdisplay.php?f=177)
-   -   CooldownFrame_SetTimer (https://www.wowinterface.com/forums/showthread.php?t=53993)

plopek 07-23-16 02:41 AM

CooldownFrame_SetTimer
 
Hello everyone,

I was using that script before to watch my trinket proc etc, but it doesn't work enymore. Dunno why:(
Can anyone take a look and help me fix it?

Lua Code:
  1. local t=CreateFrame("FRAME")
  2. t:SetPoint("CENTER",ParentUI,2,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_crusaderstrike")
  9. t:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
  10.  
  11. t:SetScript("OnEvent", function(...)
  12.     local b,_,_,e,_,_,_,_,_,_,l = select(4, ...)
  13.         if (e == UnitName("Player") and (b=="SPELL_AURA_APPLIED" or b=="SPELL_AURA_REFRESH")and l==209785) then CooldownFrame_SetTimer(cd1,GetTime(),15,1) end end)

Im getting following errors in game:
Lua Code:
  1. Message: Interface\AddOns\Frames\ExtraCD.lua:13: attempt to call global 'CooldownFrame_SetTimer' (a nil value)
  2. Time: 07/23/16 10:39:12
  3. Count: 3
  4. Stack: Interface\AddOns\Frames\ExtraCD.lua:13: in function <Interface\AddOns\Frames\ExtraCD.lua:11>
  5.  
  6. Locals: b = "SPELL_AURA_APPLIED"
  7. _ = false
  8. _ = "Player-3687-05F192B7"
  9. e = "Dasté"
  10. _ = 1297
  11. _ = 0
  12. _ = "Player-3687-05F192B7"
  13. _ = "Dasté"
  14. _ = 1297
  15. _ = 0
  16. l = 209785
  17. (*temporary) = nil
  18. (*temporary) = cd1 {
  19.  0 = <userdata>
  20. }
  21. (*temporary) = 414616.146
  22. (*temporary) = 15
  23. (*temporary) = 1
  24. (*temporary) = "attempt to call global 'CooldownFrame_SetTimer' (a nil value)"

Thanks in advance.

semlar 07-23-16 02:53 AM

It was renamed to CooldownFrame_Set, you should be able to just swap them out.

plopek 07-23-16 03:40 AM

Works great! Thanks.

One more question:)

Can I make the icon appear only when cooldown/timer starts?

semlar 07-23-16 04:02 AM

Quote:

Originally Posted by plopek (Post 316828)
Can I make the icon appear only when cooldown/timer starts?

Something like this would probably work.
Lua Code:
  1. local t=CreateFrame("FRAME")
  2. t:SetPoint("CENTER",ParentUI,2,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_crusaderstrike")
  9. t:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
  10.  
  11. t:Hide()
  12. cd1:HookScript('OnHide', function() t:Hide() end)
  13.  
  14. t:SetScript("OnEvent", function(...)
  15.     local b,_,_,e,_,_,_,_,_,_,l = select(4, ...)
  16.     if (e == UnitName("Player") and (b=="SPELL_AURA_APPLIED" or b=="SPELL_AURA_REFRESH")and l==209785) then
  17.         t:Show()
  18.         CooldownFrame_SetTimer(cd1,GetTime(),15,1)
  19.     end
  20. end)

plopek 07-23-16 04:37 AM

Works great so far however I'd like to add one more function to this. I want to track my Divine Purpose proc but this spell is consumed on use. Can we make it so icon disappear when buff isn't there enymore? Thanks:)


All times are GMT -6. The time now is 08:03 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI