WoW:API IsUsableAction: Difference between revisions

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


Checks to see if a given action is usable, and also if you have the required mana/energy/rage to activate it.
isUsable, notEnoughMana = IsUsableAction(slot)
== Parameters ==
=== Arguments ===
:;slot : Integer - The action slot to retrieve data for.
=== Returns ===
:;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.


isUsable, notEnoughMana = IsUsableAction(id);
==Notes==
 
Slots are usually distributed as follows:
----
{| class="darktable"
;''Arguments''
!Slots!!Description
 
|-
id
|1 - 12||Action Bar 1
The "id" is the actionbutton id.
|- class="alt"
 
|13 - 24||Action Bar 2
If you keep your action you want to check for usability on, say, action button 1 on action bar 1, the id is 1. If you keep it on action button 12 on bar 6, it's 6*12 = 72.
|-
 
|25 - 36||Action Bar 3 (Right)
----
|- class="alt"
;''Returns''
|37 - 48||Action Bar 4 (Right-2)
 
|-
isUsable, mana
|49 - 60||Action Bar 5 (Bottom Left)
 
|- class="alt"
isUseable = 1 or 'nil'
|61 - 72||Action Bar 6 (Bottom Right)
 
|-
----
|73 - 84||Battle Stance (Warrior) or Stealth (Rogue)
;''Example''
|- class="alt"
local isUsable, notEnoughMana = IsUsableAction(1);
|85 - 96||Defensive Stance (Warrior)
 
|-
;''Result''
|97 - 108||Berserker Stance (Warrior)
 
|}
----
;''Description''
 
 
 
----
{{Template:WoW API}}

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)