WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Legion Beta archived threads (https://www.wowinterface.com/forums/forumdisplay.php?f=177)
-   -   GetPlayerMapPosition - 7.1 (https://www.wowinterface.com/forums/showthread.php?t=54712)

Fizzlemizz 10-25-16 02:34 PM

GetPlayerMapPosition - 7.1
 
This now seems to return zero after performing a ReloadUI requiring a complete logout or exit to restore.

Edit: it now returns to producing coordinates after exiting an instance or crossing a zone boundry but still zeros moving in your current non-instanced zone after a ReloadUI.

Lombra 10-25-16 04:28 PM

Just to make sure; you're aware of the changes to this function?

Fizzlemizz 10-25-16 04:33 PM

Indeed, I ReloadUI and get zeros and nil/zeros going into/out of instances.

Logout/on and it's coordinates and nil/coordinates going into/out of instances.

Edit: It's now ReloadUI and get zeros and nil/coordinates going into/out of instances, not sure if there was a hotfix since the last time I tried it.

lightspark 10-25-16 04:52 PM

Well, you aren't supposed to get coords while in instance, so it works as intended... o_O

Fizzlemizz 10-25-16 05:01 PM

I get zeros after ReloadUI while not in an instance. The instance in/out part seems to be working now where originally I was still getting zeros after exiting an instance.

SDPhantom 10-25-16 07:44 PM

What happens if you run SetMapToCurrentZone()? If it's somehow loading up the map for an area you're not in, it's not going to give you your coordinates on it.

Fizzlemizz 10-25-16 10:09 PM

Quote:

Originally Posted by SDPhantom (Post 320276)
What happens if you run SetMapToCurrentZone()? If it's somehow loading up the map for an area you're not in, it's not going to give you your coordinates on it.

I didn't think of that, it hadn't been required pre 7.1. I'll give it a go, thank you.

Fizzlemizz 10-25-16 10:16 PM

I was was running SetMapToCurrentZone() on ZONE_CHANGED_NEW_AREA. I added PLAYER_ENTERING_WORLD and that fixed it. Thank you.

Edit for typo in the event name not causing it to trigger. Did ZONE_CHANGED_NEW_AREA used to happen when logging on?

Fizzlemizz 10-25-16 11:16 PM

Further testing on a rogue order hall with ZONE_CHANGED_NEW_AREA or PLAYER_ENTERING_WORLD registered and both calling SetMapToCurrentZone() when fired.

Glorious Goods entrance:
Niether event is fired entering or exiting the order hall. GetPlayerMapPosition("player") returns zeros when entering and coordinates when leaving.
EDIT: GetPlayerMapPosition("player") appears to be switching states. ie. if it's displaying zeros before entering it will show coordinates inside. if it's displaying coordinates before entering it will show zeros inside.

One More Glass entrance:
On entering, neither event is fired and GetPlayerMapPosition("player") returns zeros on entering (expected). On exiting, PLAYER_ENTERING_WORLD is fired which calls SetMapToCurrentZone() but GetPlayerMapPosition("player") still returns zeros.

Going to from my mage order hall gets both events entering and exiting and gets coordinates inside the order hall (I didn't expect that).

ceylina 10-26-16 08:44 AM

Just to make sure that you are only using SetMapToCurrentZone() by checking if WorldMapFrame:IsVisible() is false right? Otherwise you will do all sorts of nasty things when a user opens their world map (like reset to current zone if they select a new zone with the map open and your addon triggering)

SDPhantom 10-26-16 10:36 AM

That's the general consensus of how it's used, though there is another method I developed years ago. It would let you get data in the zone the user is in while the WorldMapFrame is up and they would never know.

Fizzlemizz 10-26-16 11:47 AM

Testing on a rogue with one addon consisting of the following
Lua Code:
  1. local f = CreateFrame("Frame")
  2. f:SetSize(10, 10)
  3. f:SetPoint("TOP", 0, -20)
  4. f.t = f:CreateFontString()
  5. f.t:SetPoint("CENTER")
  6. f.t:SetFontObject("GameFontNormal")
  7. f:SetScript("OnUpdate", function(self)
  8.         local x,y = GetPlayerMapPosition("player")
  9.         if x then
  10.             local x = format("%.1f", x*100)
  11.             local y = format("%.1f", y*100)
  12.             self.t:SetText(x .. " " .. y)
  13.         else
  14.             sellf.t:SetText("")
  15.         end
  16.     end)

Logon displays coordinates.
Enter the order hall via Glorious Goods displays zeros.
Exit the hall displays coordinates.

Enter the hall again - zeros.
/reload - zeros

Logoff/on inside the hall you now have coordinates.
Exit the hall - zeros
Exit Glorous Goods - coordinates.

Regardless of SetMapToCurrentZone(), GetPlayerMapPosition() is getting zone information and in some cases toggling how it functions. Whether this is just the rogue hall, certain order halls or certain types of instances I don't know.

Fizzlemizz 10-26-16 12:02 PM

Same test at the One More Glass entrance, same result with the exception that you don't get coordinates back when you exit but will once you cross the zone boundry by taking a taxi.

SDPhantom 10-29-16 02:57 AM

Ended up making a rogue using class trial, but I found a solution to the problem. Apparently ZONE_CHANGED_INDOORS is firing at the right time to call SetMapToCurrentZone() from in addition to PLAYER_LOGIN and ZONE_CHANGED_NEW_AREA.

Fizzlemizz 10-29-16 10:05 AM

ZONE_CHANGED_INDOORS, I hadn't thought of that, thank you. I found opening closing the map reset it without the logout/login.

Now there seems to be a coordinate "dead" zone over the sea around Dalaran when taking a taxi. Most noticable between Dal. and Stormheim. It seems to be being triggered as a dungeon rather than just inside. Not earth shattering but maybe not the only one.

SDPhantom 10-29-16 12:22 PM

There are spots in the game where no zone maps cover. These are commonly around the edges of a continent. I don't think SetMapToCurrentZone() ever chooses a continental map anymore, just whatever zone you're closest to or are currently in.

But ya, class halls appear to be scenarios internally, much like Garrisons were in WoD.


All times are GMT -6. The time now is 06:33 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI