Hobinbot@legacy41545296 (talk | contribs) (upgraded deprecated template) |
JontomXire28760@legacy41549123 (talk | contribs) No edit summary |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
{{wowapi}} |
{{wowapi}} |
||
− | <center>'''UnitPlayerControlled''' - ''Documentation by VelvetPaw''</center> |
||
Return whether the "unit" is controlled by a player or an NPC. |
Return whether the "unit" is controlled by a player or an NPC. |
||
Line 9: | Line 8: | ||
:("unit") |
:("unit") |
||
− | :;unit : String - The [[API TYPE UnitId|UnitId]] to select as a target. |
+ | :;unit : String - The [[API TYPE UnitId|UnitId]] to select as a target. Using a unit's name as the unit ID only works if the unit is a member of your party. |
=== Returns === |
=== Returns === |
Revision as of 10:20, 29 November 2009
Automated updating of API pages at this location, to reflect patch changes, has ceased from 10.1.7 onwards. |
Return whether the "unit" is controlled by a player or an NPC.
UnitIsPlayerControlled = UnitPlayerControlled("unit")
Parameters
Arguments
- ("unit")
- unit
- String - The UnitId to select as a target. Using a unit's name as the unit ID only works if the unit is a member of your party.
Returns
- UnitIsPlayerControlled
- UnitIsPlayerControlled
- Boolean - Returns true if the "unit" is controlled by a player.
Returns false if the "unit" is an NPC.
Example
if (UnitPlayerControlled("target")) then DEFAULT_CHAT_FRAME:AddMessage("Your selected target is a player.",1,1,0) else DEFAULT_CHAT_FRAME:AddMessage("Your selected target is an NPC.",1,1,0) end
Info
DEFAULT_CHAT_FRAME:AddMessage("text",r,g,b)
- ScrollingMessageFrame:AddMessage("text",r,g,b,id)
- Valid Frame names:
DEFAULT_CHAT_FRAME
ChatFrame1 - ChatFrame7