WoW:API GetPlayerMapPosition: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
No edit summary
 
m (Fixed arg list consistency)
Line 3: Line 3:
Returns the postion of a unit on the current map
Returns the postion of a unit on the current map


  GetPlayerMapPosition(who);
  posX, posY = GetPlayerMapPosition("unit");


----
----
;''Arguments''
;''Arguments''


:String who
:("unit")
:;who : Specifies the object for which the position is returned, valid are:<br>"player": current player<br>"party1", "party2", "party3", "party4": one of your group members<br>"target": the current target <small>- can't check, but does only work on friendly units, if ever</small><br>"anyPlayerName": of the player with that name <small>- can't check, but does only work on friendly units, if ever</small>
:;unit : String - The [[API TYPE UnitId|UnitId]] for which the position is returned. (Verified for <tt>player</tt>, <tt>party</tt>*, <tt>target</tt> and <tt>mouseover</tt> (Though the latter two may only work for friendly players). Does not appear to work for <tt>pet</tt> (Tested with warlock)).


----
----
;''Returns''
;''Returns''


:Number posX, Number posY
:posX, posY
:;posX : x value of the player position (in percent, relative to WorldMapDetailFrame)
:;posX : Number - X value of the unit position (a proprotion between 0 and 1, relative to WorldMapDetailFrame)
:;posY : y value of the player position (in percent, relative to WorldMapDetailFrame)
:;posY : Number - Y value of the unit position (a proportion between 0 and 1, relative to WorldMapDetailFrame)
 
If both posX and posY are 0, then the position is unknown, unknowable, or not valid for the current map.


----
----
;''Example''
;''Example''
  local posX, posY = GetPlayerMapPosition();
  local posX, posY = GetPlayerMapPosition("player");
   
   


;''Result''
;''Result''
  0.43320921063423, 0.69365233182907
  0.43320921063423, 0.69365233182907
----
;''Description''
:
Returns the postion of the player (argument) on the current map. (Both values equal zero, when the player is not on the currently shown map.)


----
----
{{Template:WoW API}}
{{Template:WoW API}}

Revision as of 21:57, 26 December 2004

GetPlayerMapPosition -Documentation by Meog-

Returns the postion of a unit on the current map

posX, posY = GetPlayerMapPosition("unit");

Arguments
("unit")
unit
String - The UnitId for which the position is returned. (Verified for player, party*, target and mouseover (Though the latter two may only work for friendly players). Does not appear to work for pet (Tested with warlock)).

Returns
posX, posY
posX
Number - X value of the unit position (a proprotion between 0 and 1, relative to WorldMapDetailFrame)
posY
Number - Y value of the unit position (a proportion between 0 and 1, relative to WorldMapDetailFrame)

If both posX and posY are 0, then the position is unknown, unknowable, or not valid for the current map.


Example
local posX, posY = GetPlayerMapPosition("player");

Result
0.43320921063423, 0.69365233182907

Template:WoW API