WoW:API IsUsableAction: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
m (Move page script moved page API IsUsableAction to API IsUsableAction without leaving a redirect)
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<center>'''IsUsableAction'''</center>
{{wowapi}} __NOTOC__
 
Determine if an action can be used (you have sufficient mana, reagents and the action is not on cooldown).
Determine if an action can be used.


  isUsable, notEnoughMana = IsUsableAction(slot)
  isUsable, notEnoughMana = IsUsableAction(slot)
== Parameters ==
== Parameters ==
=== Arguments ===
=== Arguments ===
:(slot)
:;slot : Integer - The action slot to retrieve data for.
:;slot : Integer - The action slot to retrieve data for.
For a warrior, the action slot numbering is
  25-36  bar on right-side of screen, far right    (top to bottom)
  37-48  bar on right-side of screen, in one column    (top to bottom)
  49-60  lower right bar    (left to right)
  61-72  lower left  bar    (left to right)
  73-84  battle stance bar    (left to right)
  85-96  defensive stance bar    (left to right)
  97-108 berserker stance bar    (left to right)
For a rogue, the default Blizzard UI action slot numbering is
  1-12  main bar
  13-24  unknown. I could not find what these 12 buttons were
  25-36  far right (on the right) (added through Interface Options)    (top to bottom)
  37-48  far right (on the left) (added through Interface Options)    (top to bottom)
  49-60  bottom right (added through Interface Options)    (left to right)
  61-72  bottom left (added through Interface Options)    (left to right)
  73-84  stealth bar    (left to right)
not sure for other classes, but it is probably different.
=== Returns ===
=== Returns ===
:isUsable, notEnoughMana
:;isUsable : Flag - Returns 1 if the action is valid for use at present (Does NOT include cooldown or range tests), nil otherwise.
:;isUsable : Flag - Returns 1 if the action is valid for use at present (Does NOT include cooldown or range tests), nil otherwise.
:;notEnoughMana : Flag - Returns 1 if the reason for the action not being usable is because there is not enough mana/rage/energy, nil otherwise.
:;notEnoughMana : Flag - Returns 1 if the reason for the action not being usable is because there is not enough mana/rage/energy, nil otherwise.
== Example ==
 
<!-- begin code -->
==Notes==
local isUsable, notEnoughMana = IsUsableAction(1);
Slots are usually distributed as follows:
<!-- end code -->
{| class="darktable"
----
!Slots!!Description
__NOTOC__
|-
{{Template:WoW API}}
|1 - 12||Action Bar 1
|- class="alt"
|13 - 24||Action Bar 2
|-
|25 - 36||Action Bar 3 (Right)
|- class="alt"
|37 - 48||Action Bar 4 (Right-2)
|-
|49 - 60||Action Bar 5 (Bottom Left)
|- class="alt"
|61 - 72||Action Bar 6 (Bottom Right)
|-
|73 - 84||Battle Stance (Warrior) or Stealth (Rogue)
|- class="alt"
|85 - 96||Defensive Stance (Warrior)
|-
|97 - 108||Berserker Stance (Warrior)
|}

Latest revision as of 04:46, 15 August 2023

WoW API < IsUsableAction

Determine if an action can be used (you have sufficient mana, reagents and the action is not on cooldown).

isUsable, notEnoughMana = IsUsableAction(slot)

Parameters[edit]

Arguments[edit]

slot
Integer - The action slot to retrieve data for.

Returns[edit]

isUsable
Flag - Returns 1 if the action is valid for use at present (Does NOT include cooldown or range tests), nil otherwise.
notEnoughMana
Flag - Returns 1 if the reason for the action not being usable is because there is not enough mana/rage/energy, nil otherwise.

Notes[edit]

Slots are usually distributed as follows:

Slots Description
1 - 12 Action Bar 1
13 - 24 Action Bar 2
25 - 36 Action Bar 3 (Right)
37 - 48 Action Bar 4 (Right-2)
49 - 60 Action Bar 5 (Bottom Left)
61 - 72 Action Bar 6 (Bottom Right)
73 - 84 Battle Stance (Warrior) or Stealth (Rogue)
85 - 96 Defensive Stance (Warrior)
97 - 108 Berserker Stance (Warrior)