WoW:API UnitIsAFK: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(Updated to match the current API boilerplate.)
Line 1: Line 1:
{{wowapi}} __NOTOC__
{{wowapi}} __NOTOC__
Checks if a unit is AFK.
Checks if a unit is AFK.
  isAFK = UnitIsAFK([[UnitId|unitId]])
  isAFK = UnitIsAFK("unit")
 


=== Arguments ===
=== Arguments ===
:;unitId : The [[UnitId]] to check
;unit : The [[UnitId]] to return AFK status of.
 


=== Returns ===
=== Returns ===
:; isAFK : [[Boolean]] - Whether the unit is AFK
; isAFK : 1 if unit is AFK, nil otherwise.
 


== Example ==  
== Example ==  
  afk = UnitIsAFK("player");
If the player is AFK, the following script outputs "You are AFK" to the default chat window.
if afk then
  if UnitIsAFK("player") then
   DEFAULT_CHAT_FRAME:AddMessage("You are AFK");
   DEFAULT_CHAT_FRAME:AddMessage("You are AFK");
  end
  end
<big>'''Results'''</big>
If the player is AFK, it outputs "You are AFK" to the default chat window.

Revision as of 15:46, 11 July 2008

WoW API < UnitIsAFK

Checks if a unit is AFK.

isAFK = UnitIsAFK("unit")

Arguments

unit
The UnitId to return AFK status of.

Returns

isAFK
1 if unit is AFK, nil otherwise.

Example

If the player is AFK, the following script outputs "You are AFK" to the default chat window.

if UnitIsAFK("player") then
  DEFAULT_CHAT_FRAME:AddMessage("You are AFK");
end