WoW:API IsUsableAction: Difference between revisions

m
Move page script moved page API IsUsableAction to WoW:API IsUsableAction without leaving a redirect
mNo edit summary
m (Move page script moved page API IsUsableAction to WoW:API IsUsableAction without leaving a redirect)
 
(7 intermediate revisions by 7 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. Does not consider cooldown.
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. Action bar 1 starts at id 1, action bar 2 starts at id 12, action bar 3 at id 24 and so on.
|-
If you keep it on action button 5 on bar 3, it's (3-1)*12 + 5 = 27.
|25 - 36||Action Bar 3 (Right)
 
|- class="alt"
----
|37 - 48||Action Bar 4 (Right-2)
;''Returns''
|-
 
|49 - 60||Action Bar 5 (Bottom Left)
isUsable, notEnoughMana
|- class="alt"
 
|61 - 72||Action Bar 6 (Bottom Right)
isUseable = 1 if the action button is useable, or 'nil' if it is not.
|-
 
|73 - 84||Battle Stance (Warrior) or Stealth (Rogue)
notEnoughMana = 1 if low mana is the cause, or 'nil' if mana is not the cause, or if the button is usable.
|- class="alt"
 
|85 - 96||Defensive Stance (Warrior)
----
|-
;''Example''
|97 - 108||Berserker Stance (Warrior)
local isUsable, notEnoughMana = IsUsableAction(1);
|}
 
;''Result''
 
----
;''Description''
 
 
 
----
{{Template:WoW API}}
[[Category:API Functions|IsUsableAction]]
[[Category:API Action Functions|IsUsableAction]]
Anonymous user