Greetings, I am making my own addon for WoW Classic, in which I summarize my most important spells in one extra small action bar. Now when I use for example Kidney or Kick on my rogue, I want the extra frame to incur a visual cooldown; but when I use the function SetCooldownDuration this error always throws:
Message: Interface\AddOns\MyAddon\MyAddon.lua:496: Usage: kickCd:SetCooldownDuration(duration[, modRate])
Time: Thu Oct 17 01:50:46 2019
Count: 1
Stack: Interface\AddOns\MyAddon\MyAddon.lua:496: Usage: kickCd:SetCooldownDuration(duration[, modRate])
[C]: in function `SetCooldownDuration'
Interface\AddOns\MyAddon\MyAddon.lua:496: in function <Interface\AddOns\MyAddon\MyAddon.lua:493>
Interface\AddOns\MyAddon\MyAddon.lua:545: in function <Interface\AddOns\MyAddon\MyAddon.lua:510>
(tail call): ?
Locals: (*temporary) = kickCd {
0 = <userdata>
}
(*temporary) = nil
It’s lecturing me on how to use the SetCooldownDuration function but it’s literally the same exact way I’m already using it.
You are somehow passing it a nil. Make sure you are getting the proper duration since some API in classic e.g. don’t return spell ranks and spell ids anymore
Thanks for your reply Ketho-mirage-raceway.
It’s being weird on more than one level. I even hardcoded all my relevant cooldowns numbers so I don’t actually even pull them off the SpellInfo parameters.
This iconFrames is my table containing the cooldowns I try to watch.
I even tried to use the references of the frames from the Global table, the outcome is the same. Btw I have 3 cooldowns to watch (kidney - kick - gouge), so I have 3 frames for the icons and 3 separate cooldown frames, and I pass these frames EITHER like: applyCooldown(kickFrame, 12, kickCd)
OR: applyCooldown(iconFrames.Kick.frame, iconFrames.Kick.cd, iconFrames.Kick.cdFrame)
it does not matter, it always throws that error.
And this is the body of applyCooldown func:
local function applyCooldown(parentIcon, duration, cdFrame)
cdFrame:SetSize(50, 50)
cdFrame:SetCooldownDuration(duration)
cdFrame:SetPoint("CENTER", parentIcon, 0, 0)
end
so as it’s evident I should be using the SetCooldownDuration the way it is supposed to.
Btw none of those frames are actually nil EVER, I can get their info printed at will.
It seems to work fine for me https://imgur.com/a/wIJJwXc
local f = CreateFrame("Frame")
f:SetSize(64, 64)
f:SetPoint("CENTER")
local tex = f:CreateTexture()
tex:SetAllPoints()
tex:SetTexture(136243) -- trade_engineering
local cd = CreateFrame("Cooldown", "SomeCooldown", f, "CooldownFrameTemplate")
EDIT: Finally it fixed. I accidentally both forgot to inherit the template AND made the cooldown a child of UIParent instead of the actual icon frame! Ty for the head ups man. Extremely appreciated.