WoW:API GetActionCooldown: Difference between revisions

m (Updated formatting)
m (Move page script moved page API GetActionCooldown to API GetActionCooldown without leaving a redirect)
 
(5 intermediate revisions by 5 users not shown)
Line 1: Line 1:
<center>'''GetActionCooldown''' - ''Documentation by Sarf''</center>
{{wowapi}} __NOTOC__


Retrieves the cooldown data of the action specified.
Retrieves the [[cooldown]] data of the action specified.


  start, duration, enable = GetActionCooldown(slot)
  start, duration, enable = GetActionCooldown(slot)
== Parameters ==
== Parameters ==
=== Arguments ===
<big>'''Arguments'''</big>
:(slot)
 
:;slot : Integer - The [[ActionSlot|action slot]] to retrieve data from.
 
<big>'''Returns'''</big>


:;slot : Integer - The action slot to retrieve data from.
=== Returns ===
:start, duration, enable
:start, duration, enable


:;start : Number - The time at which the current cooldown period began (Relative to the result of [[API GetTime|GetTime]]), or 0 if the cooldown is not active or not applicable.
:;start : Number - The time at which the current cooldown period began (relative to the result of [[API GetTime|GetTime]]), or 0 if the cooldown is not active or not applicable.
:;duration : Number - The duration of the current cooldown period in seconds, or 0 if the cooldown is not active or not applicable.
:;duration : Number - The duration of the current cooldown period in seconds, or 0 if the cooldown is not active or not applicable.
:;enable : Number - Indicate if cooldown is enabled, is greater than 0 if a cooldown is active, and 0 if a cooldown cannot be active. (Exactly what this is for is slightly unclear).
:;enable : Number - Indicate if cooldown is enabled, is greater than 0 if a cooldown is active, and 0 if a cooldown cannot be active. This lets you know when a shapeshifting form has ended and the actual countdown has started.
 
== Example ==
== Example ==
<!-- begin code -->
<!-- begin code -->
  local start, duration, enable = GetActionCooldown(slot);
  local start, duration, enable = GetActionCooldown(slot);
  if ( start &gt; 0 and duration &gt; 0 and enable &gt; 0) then
  if ( start == 0 ) then
-- do stuff when cooldown is not active
else
  -- do stuff when cooldown is under effect
  -- do stuff when cooldown is under effect
else
-- do stuff when cooldown is not active
  end
  end
<!-- end code -->
<!-- end code -->
----
__NOTOC__
{{Template:WoW API}}
[[Category:API Action Functions|GetActionCooldown]]

Latest revision as of 04:45, 15 August 2023

WoW API < GetActionCooldown

Retrieves the cooldown data of the action specified.

start, duration, enable = GetActionCooldown(slot)

Parameters

Arguments

slot
Integer - The action slot to retrieve data from.

Returns

start, duration, enable
start
Number - The time at which the current cooldown period began (relative to the result of GetTime), or 0 if the cooldown is not active or not applicable.
duration
Number - The duration of the current cooldown period in seconds, or 0 if the cooldown is not active or not applicable.
enable
Number - Indicate if cooldown is enabled, is greater than 0 if a cooldown is active, and 0 if a cooldown cannot be active. This lets you know when a shapeshifting form has ended and the actual countdown has started.

Example

local start, duration, enable = GetActionCooldown(slot);
if ( start == 0 ) then
	-- do stuff when cooldown is not active
else
	-- do stuff when cooldown is under effect
end