m
Move page script moved page API GetPlayerMapPosition to WoW:API GetPlayerMapPosition without leaving a redirect
(Formatting mostly) |
m (Move page script moved page API GetPlayerMapPosition to WoW:API GetPlayerMapPosition without leaving a redirect) |
||
| (9 intermediate revisions by 9 users not shown) | |||
| Line 1: | Line 1: | ||
{{wowapi}} __NOTOC__ | {{wowapi}} __NOTOC__ | ||
Returns the | ==Initialization== | ||
A one-time call to [[API SetMapToCurrentZone|SetMapToCurrentZone]]() is required before GetPlayerMapPosition() will return the correct values. | |||
==Usage== | |||
Returns the position of a unit on the current map | |||
posX, posY = GetPlayerMapPosition("unit"); | posX, posY = GetPlayerMapPosition("unit"); | ||
| Line 16: | Line 20: | ||
:;posY : Number - Y value of the unit position (a proportion 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 exactly 0, the position is unknown, unknowable, or not valid for the current map, i.e. | : If both posX and posY are exactly 0, the position is unknown, unknowable, or not valid for the current map, i.e. | ||
:* The map hasn't been updated yet; either open the map or use [[API SetMapToCurrentZone|SetMapToCurrentZone]]() after entering a new zone | :* The map hasn't been updated yet; either open the map or use [[API SetMapToCurrentZone|SetMapToCurrentZone]]() after entering a new zone | ||
:* An unsupported [[unitId]] was given. | :* An unsupported [[unitId]] was given. | ||
:* You're actually at 0,0 in a given map, which although its unlikely, its perfectly possible and legal. | |||
== Example == | == Example == | ||