WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Cooldown frame not seeing cooldown animation? (https://www.wowinterface.com/forums/showthread.php?t=57975)

MinguasBeef 05-02-20 05:32 PM

Cooldown frame not seeing cooldown animation?
 
This is my code i'm using to create a frame with a texture/cooldown frame attached.

Code:

local f = CreateFrame("FRAME")
f:SetWidth(32)
f:SetHeight(32)
f:SetPoint("CENTER")

local cdFrame = CreateFrame("Cooldown", nil, f)
cdFrame:SetAllPoints(f)
cdFrame:SetSwipeColor(1, 1, 1)

local texture = f:CreateTexture(nil, "BACKGROUND")
texture:SetAllPoints(f)
texture:SetTexCoord(0.07,0.9,0.07,0.90)
texture:SetTexture(132242)

f:Show()

cdFrame:SetCooldown(GetTime(), 10)

This is what I see.



Any idea why I cannot see the darkened cooldown area?

Xrystal 05-02-20 05:38 PM

I have this set up for my mage portals addon and I am pretty sure I had the swipe stuff working on it.

Lua Code:
  1. -- Get the cooldown informaton and if it is just the general cooldown, don't bother
  2.     local cdStart, cdDuration, cdEnabled, cdRate = GetSpellCooldown(id)
  3.     local cdDrawEdge = false
  4.        
  5.     if cdDuration and cdDuration < 2 then return end
  6.  
  7.     button.Cooldown:SetEdgeTexture("Interface\\Cooldown\\edge");
  8.     button.Cooldown:SetSwipeColor(1, 1, 0.8);   >>>>>>>>>>>>>>> Missing this perhaps ?
  9.     button.Cooldown:SetHideCountdownNumbers(false);
  10.     button.Cooldown.currentCooldownType = COOLDOWN_TYPE_NORMAL;
  11.     button.Cooldown:SetCooldown(cdStart, cdDuration)
  12.     button.Cooldown:Show()

MinguasBeef 05-02-20 05:52 PM

Quote:

Originally Posted by Xrystal (Post 335811)
I have this set up for my mage portals addon and I am pretty sure I had the swipe stuff working on it.

Lua Code:
  1. -- Get the cooldown informaton and if it is just the general cooldown, don't bother
  2.     local cdStart, cdDuration, cdEnabled, cdRate = GetSpellCooldown(id)
  3.     local cdDrawEdge = false
  4.        
  5.     if cdDuration and cdDuration < 2 then return end
  6.  
  7.     button.Cooldown:SetEdgeTexture("Interface\\Cooldown\\edge");
  8.     button.Cooldown:SetSwipeColor(1, 1, 0.8);   >>>>>>>>>>>>>>> Missing this perhaps ?
  9.     button.Cooldown:SetHideCountdownNumbers(false);
  10.     button.Cooldown.currentCooldownType = COOLDOWN_TYPE_NORMAL;
  11.     button.Cooldown:SetCooldown(cdStart, cdDuration)
  12.     button.Cooldown:Show()

I've updated my code, but I still get the same behavior. :(

Fizzlemizz 05-02-20 06:15 PM

Any reason you're not using the CooldownFrameTemplate?

Lua Code:
  1. local f = CreateFrame("FRAME")
  2. f:SetWidth(32)
  3. f:SetHeight(32)
  4. f:SetPoint("CENTER")
  5.  
  6. local cdFrame = CreateFrame("Cooldown", "MyCdFrame", f,  "CooldownFrameTemplate")
  7. cdFrame:SetAllPoints(f)
  8. cdFrame:SetSwipeColor(1, 1, 1)
  9.  
  10. local texture = f:CreateTexture(nil, "BACKGROUND")
  11. texture:SetAllPoints(f)
  12. texture:SetTexCoord(0.07,0.9,0.07,0.90)
  13. texture:SetTexture(132242)
  14.  
  15. f:Show()
  16.  
  17. MyCdFrame:SetCooldown(GetTime(), 10)

Code:

/run MyCdFrame:SetCooldown(GetTime(), 10)
to play it over.

MinguasBeef 05-02-20 06:25 PM

Quote:

Originally Posted by Fizzlemizz (Post 335813)
Any reason you're not using the CooldownFrameTemplate?

Lua Code:
  1. local f = CreateFrame("FRAME")
  2. f:SetWidth(32)
  3. f:SetHeight(32)
  4. f:SetPoint("CENTER")
  5.  
  6. local cdFrame = CreateFrame("Cooldown", "MyCdFrame", f,  "CooldownFrameTemplate")
  7. cdFrame:SetAllPoints(f)
  8. cdFrame:SetSwipeColor(1, 1, 1)
  9.  
  10. local texture = f:CreateTexture(nil, "BACKGROUND")
  11. texture:SetAllPoints(f)
  12. texture:SetTexCoord(0.07,0.9,0.07,0.90)
  13. texture:SetTexture(132242)
  14.  
  15. f:Show()
  16.  
  17. MyCdFrame:SetCooldown(GetTime(), 10)

Code:

/run MyCdFrame:SetCooldown(GetTime(), 10)
to play it over.

Ah, this was the issue! Thanks!

I was porting some old stuff that was compatible with the 2.4.3 client and it did not use that template. I didn't even know about it. Ty!

Xrystal 05-02-20 09:11 PM

Rofl .. I totally missed the missing template .. I have that in my xml code for my frame.


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

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