WoW:API GetSpellCooldown: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 21: Line 21:
;''Returns''
;''Returns''


:(Number startTime, Number duration)
:(Number startTime, Number duration, Number enable)


:;startTime : The time when the cooldown started (as returned by [[API GetTime|GetTime()]]) or zero if no cooldown
:;startTime : The time when the cooldown started (as returned by [[API GetTime|GetTime()]]) or zero if no cooldown
:;duration : The number of seconds the cooldown will last, or zero if no cooldown
:;duration : The number of seconds the cooldown will last, or zero if no cooldown


Note: The current wiki page for GetActionSlotCooldown() page gives a third return variable, but this function appears to either only return two variables or always give "1" (perhaps it's if the function successly completed or not?).
:;enable : Appears to be set to 1 if this spell is in cooldown, and 0 otherwise.


----
----

Revision as of 20:09, 26 September 2005

GetActionCooldown -Documentation by Thrae-

Retrieves the cooldown data of the spell specified.

local start, duration = GetActionCooldown(spellID, spellnumTab);

Arguments
(Number spellID)
spellID
The ID of the spell to retrieve cooldown data for
(Number spellnumTab)
spellnumTab
The tab within your spellbook, ignore empty slots. As of 1.41 this argument appears to be required, but not used.

Returns
(Number startTime, Number duration, Number enable)
startTime
The time when the cooldown started (as returned by GetTime()) or zero if no cooldown
duration
The number of seconds the cooldown will last, or zero if no cooldown
enable
Appears to be set to 1 if this spell is in cooldown, and 0 otherwise.

Example
local start, duration = GetSpellCooldown(spellID, spellnumTab);
if ( start > 0 and duration > 0) then
	Print('Please wait ' .. duration - ( GetTime() - start) .. ' seconds before using this spell.');
else
	Print('Spell is ready.');
end
Result
Retrieves data. Does not (to my knowledge) actually change anything.

Description
Retrieves data on the cooldown of a specific spell within your spellbook.

Template:WoW API