View Single Post
07-07-18, 10:47 PM   #17
siweia
A Flamescale Wyrmkin
 
siweia's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2011
Posts: 126
I found this in LeatixPlus by using "RunScript", and it does not produce memory waste.

Code:
local pTimer = 0

local function UpdateCharacterCoords(self, elapsed)
	pTimer = pTimer + elapsed
	if pTimer > 0.2 then
		RunScript('LeaPlusGlobalCoords = C_Map.GetPlayerMapPosition(0, "player")')
		if LeaPlusGlobalCoords then
			cChar.x:SetFormattedText("%0.1f", LeaPlusGlobalCoords.x * 100)
			cChar.y:SetFormattedText("%0.1f", LeaPlusGlobalCoords.y * 100)
		else
			cChar.x:SetText("")
			cChar.y:SetText("")
		end
		pTimer = 0
	end
end
cChar:SetScript("OnUpdate", UpdateCharacterCoords)

Last edited by siweia : 07-07-18 at 10:57 PM.
  Reply With Quote