Returns cooldown information about an action
See also Action functions.
Signature:
start,
duration,
enable
=
GetActionCooldown(slot)
Arguments:
slot
- An action bar slot (number
, actionID)
Returns:
start
- The value ofGetTime()
at the moment the cooldown began, or 0 if the action is ready (number
)duration
- The length of the cooldown, or 0 if the action is ready (number
)enable
- 1 if a Cooldown UI element should be used to display the cooldown, otherwise 0. (Does not always correlate with whether the action is ready.) (number
)
Examples:
-- Show all actions currently on cooldown for i=1,120 do local start,duration,enable = GetActionCooldown(i) if start > 0 and enable == 1 then local actiontype,id,subtype = GetActionInfo(i) local name if actiontype == "spell" then name = GetSpellName(id, "spell") elseif actiontype == "item" then name = GetItemInfo(id) elseif actiontype == "companion" then name = select(2, GetCompanionInfo(subtype, id)) end local timeLeft = math.floor((start + duration) - GetTime()) local output = string.format("Cooldown on %s %s (%s seconds left)", actiontype, name, timeLeft) ChatFrame1:AddMessage(output) end end