Navigation menu

WoW:UnitId: Difference between revisions

Jump to navigation Jump to search
130 bytes added ,  17 June 2008
m
Line 8: Line 8:


; <tt>"player"</tt> : The current player.
; <tt>"player"</tt> : The current player.
:: It appears that you can also use the current player's proper name in place of "player" (e.g. "[[Server:Cenarion_Circle_US/Treader|Treader]]"). Although; it seems a little unnecessary since "player" requires no effort from the Lua engine. Plus getting the current player's proper name involves passing "player" to [[API_UnitName|UnitName]](), so you might as well just pass "player" to whichever function you are calling.


; <tt>"pet"</tt> : The current player's pet
; <tt>"pet"</tt> : The current player's pet
Line 26: Line 25:
; <tt>"mouseover"</tt> : The unit which the mouse is currently (or was most recently) hovering over
; <tt>"mouseover"</tt> : The unit which the mouse is currently (or was most recently) hovering over


; <tt>"none"</tt>: A valid unit token that always refers to no unit.
; <tt>"none"</tt>: A valid unit token that always refers to no unit. [[API_UnitName|UnitName]] will return "Unknown, nil" for this UnitID.


==Others==
==Others==
The following value also appears in some very specific places (Vendor interactions, for example) or functions.
The following value also appears in some very specific places (Vendor interactions, for example) or functions.


; <tt>"npc"</tt> : The NPC with which the player is currently interacting.
; <tt>"npc"</tt> : The NPC with which the player is currently interacting. You '''must''' be interacting with the NPC for this to work (e.g. the quest, flight path, merchant, gossip, or bank frame is open).


You can also use the name of a party or raid member as a unit ID:
; <tt>player name</tt> : As returned by [[API_UnitName|UnitName]], [[API_GetGuildRosterInfo|GetGuildRosterInfo]], [[API_GetFriendInfo|GetFriendInfo]], [[API COMBAT LOG EVENT|COMBAT LOG EVENT]], etc. This must be spelled exactly and will be invalid if the named player is not a part of your party or raid. As with all other UnitIDs, it is not case sensitive.
 
; <tt>"''name''"</tt> : This must be spelled exactly and will be invalid if the named player is not a part of your party or raid.


== Targets ==
== Targets ==
Line 42: Line 39:


If you are using a party or raid member's name as a unit, you need to use hyphens to separate the target chain (e.g. <tt>"Cogwheel-target-target"</tt>).
If you are using a party or raid member's name as a unit, you need to use hyphens to separate the target chain (e.g. <tt>"Cogwheel-target-target"</tt>).
You can have a seemingly endless string of chained units (e.g. <tt>target-target-target-target-target-target-target-target-target-target-target-target-target-target-target-target-...</tt>).


== Notes ==
== Notes ==
Line 47: Line 46:
Many of the functions which take a UnitId only provide useful results for a subset of ID's. Other functions will only provide information for friendly targets (or those upon which a power is active).
Many of the functions which take a UnitId only provide useful results for a subset of ID's. Other functions will only provide information for friendly targets (or those upon which a power is active).


Also, some functions return different values if the target is close enough to be 'visible' to your client (not necessarily in line of sight), as can be determined with [[API UnitIsVisible|UnitIsVisible("unit")]], versus further away.
Also, some functions return different values if the target is close enough to be 'visible' to your client (not necessarily in line of sight), as can be determined with [[API UnitIsVisible|UnitIsVisible("unit")]], versus farther away.
Anonymous user