/run gf:Hide() -- stop
/run gf:Show() -- start
Although using gf as a global frame name is not ideal nor is updating the text every tick.
/run gf:Hide() -- stop
/run gf:Show() -- start
/run local p,f="player",CreateFrame("Button",nil,UIParent,"OptionsButtonTemplate")f:SetPoint("TOP",0,0)f:SetScript("OnUpdate",function(s,e)x,y=C_Map.GetPlayerMapPosition(C_Map.GetBestMapForUnit(p),p):GetXY()f:SetText(format("(%.1f,%.1f)",x*100,y*100))end)
07/06/2016 08:05 PMPosted by DarkrevdkThis frustrated me to no end that I would have to get an addon with a ton of crap, just to show my coordinates.
So, I dug a bit and figured out how to code it out, the examples above really helped.
This will create a new box at the top of your screen showing your coordinates:/run local p,f,x,y="player",gf or CreateFrame("Button","gf",UIParent,"UIGoldBorderButtonTemplate") f:SetPoint("TOP",0,0) f:SetWidth(80) f:SetScript("OnUpdate",function(s,e) x,y=GetPlayerMapPosition(p) f:SetText(format("(%.1f,%.1f)",x*100,y*100)) end)
06/24/2018 09:03 PMPosted by SryffStill works two years later!
06/19/2018 04:39 AMPosted by DumbFor anyone wanting this for BfA (as map coords have changed in bfa) here is an updated macro. It doesn't look beautiful but I had to compromise due to macro space. This script is exactly 255 characters./run local p,f="player",CreateFrame("Button",nil,UIParent,"OptionsButtonTemplate")f:SetPoint("TOP",0,0)f:SetScript("OnUpdate",function(s,e)x,y=C_Map.GetPlayerMapPosition(C_Map.GetBestMapForUnit(p),p):GetXY()f:SetText(format("(%.1f,%.1f)",x*100,y*100))end)
07/18/2018 11:19 AMPosted by Jodagondrago06/19/2018 04:39 AMPosted by DumbFor anyone wanting this for BfA (as map coords have changed in bfa) here is an updated macro. It doesn't look beautiful but I had to compromise due to macro space. This script is exactly 255 characters./run local p,f="player",CreateFrame("Button",nil,UIParent,"OptionsButtonTemplate")f:SetPoint("TOP",0,0)f:SetScript("OnUpdate",function(s,e)x,y=C_Map.GetPlayerMapPosition(C_Map.GetBestMapForUnit(p),p):GetXY()f:SetText(format("(%.1f,%.1f)",x*100,y*100))end)
tried putting this as a macro but nothing seemed to happen when I pressed it. :(
02/03/2017 04:20 PMPosted by Vvar/script x,y = GetPlayerMapPosition("player"); map=GetZoneText(); c1=x*100;c2=y*100; print(string.format("%s: %.2f, %.2f", map, c1, c2));
/run local s,id,c,x,y=function()print("No")end,C_Map.GetBestMapForUnit("player")if not id then s()return end c=C_Map.GetPlayerMapPosition(id,"player")if not c then s()return end x,y=c:GetXY()print(string.format("%s:%.2f,%.2f",GetZoneText(),x*100,y*100))
For anyone wanting this for BfA (as map coords have changed in bfa) here is an updated macro. It doesn't look beautiful but I had to compromise due to macro space. This script is exactly 255 characters./run local p,f="player",CreateFrame("Button",nil,UIParent,"OptionsButtonTemplate")f:SetPoint("TOP",0,0)f:SetScript("OnUpdate",function(s,e)x,y=C_Map.GetPlayerMapPosition(C_Map.GetBestMapForUnit(p),p):GetXY()f:SetText(format("(%.2f,%.2f)",x*100,y*100))end)
06/19/2018 04:39 AMPosted by DumbFor anyone wanting this for BfA (as map coords have changed in bfa) here is an updated macro. It doesn't look beautiful but I had to compromise due to macro space. This script is exactly 255 characters./run local p,f="player",CreateFrame("Button",nil,UIParent,"OptionsButtonTemplate")f:SetPoint("TOP",0,0)f:SetScript("OnUpdate",function(s,e)x,y=C_Map.GetPlayerMapPosition(C_Map.GetBestMapForUnit(p),p):GetXY()f:SetText(format("(%.1f,%.1f)",x*100,y*100))end)
Can someone rewrite this macro to output in the chat input box /way X, Y
This one worked for me. I just want to be able to add a waypoints easily
/run local p,f=âplayerâ,CreateFrame(âButtonâ,nil,UIParent,âOptionsButtonTemplateâ)f:SetPoint(âTOPâ,0,0)f:SetScript(âOnUpdateâ,function(s,e)x,y=C_Map.GetPlayerMapPosition(C_Map.GetBestMapForUnit§,p):GetXY()f:SetText(format("(%.2f,%.2f)",x100,y100))end)
If youâre using TomTom for /way x y:
/run local m,x,y=TomTom:GetCurrentPlayerPosition() ChatFrame_OpenChat() ChatFrame1EditBox:SetText(format("/way %.1f %.1f",(x or 0)*100,(y or 0)*100))
If youâre only making waypoints in outdoor areas this will add the map to the waypoint so using the command in another zone will put the waypoint in the right zone:
/run local m,x,y=TomTom:GetCurrentPlayerPosition() if x and y then ChatFrame_OpenChat() ChatFrame1EditBox:SetText(format("/way #%d %.1f %.1f",m,x*100,y*100)) else print("You're in an instance/subzone that doesn't support standard coordinates.") end
Thank you !
You necroâd a years old post to say âthank youâ?
Please, for the love of G-d, read the forum guidelines and pay attention to the spam rules.
And no, this is not a valid reason to dredge up a thread from almost 10 years ago.
A while ago I was frustrated about the loss of the working version UI auto updating map coordinates. I figured there must still be a way, and I got this working. I hope this is a valid reason to necro an old post.
Sometime after BfA it seems OptionsButtonTemplate
stopped being a thing; but I found UIPanelButtonTemplate
in some documentation with examples. So I managed to get this working. I also discovered the word local
was unnecessary, so I got to save a few valuable characters.
/run local p,f="player",CreateFrame("Button",nil,UIParent,"UIPanelButtonTemplate")f:SetPoint("TOP",0,0)f:SetScript("OnUpdate",function(s,e)x,y=C_Map.GetPlayerMapPosition(C_Map.GetBestMapForUnit(p),p):GetXY()f:SetText(format("(%.2f,%.2f)",x*100,y*100))end)
I hope this can help some people! I know the chat map coordinates are a fine bandage solution; but this is the real deal.
Part of the reason this thread has had traction for 10 years is because when you google âwow map coordinatesâ itâs one of the first appealing links that showup. Iâve returned back to this thread multiple times over my years playing WoW.
Removing local
makes the variables global and can cause all sorts of potential conflicts.
Fortunately the current macro is still within the 255 limit with it included
/run local p,f="player",CreateFrame("Button",nil,UIParent,"UIPanelButtonTemplate")f:SetPoint("TOP",0,0)f:SetScript("OnUpdate",function(s,e)x,y=C_Map.GetPlayerMapPosition(C_Map.GetBestMapForUnit(p),p):GetXY()f:SetText(format("(%.2f,%.2f)",x*100,y*100))end)
Enable script errors /console scriptErrors 1
or install BugSack and BugGrabber to see what itâs choking on.
you know⌠that actually might make a lot of sense. every so often the game will prompt me that it seems like one of my addons is causing problems; but iâve never noticed what they might be.
thanks for the tip. iâve added local back into my macro