Skip to content

Instantly share code, notes, and snippets.

@dolphinspired
Last active August 11, 2020 02:03
Show Gist options
  • Save dolphinspired/702714aa65a50c8f1dda8404966c2834 to your computer and use it in GitHub Desktop.
Save dolphinspired/702714aa65a50c8f1dda8404966c2834 to your computer and use it in GitHub Desktop.
Help for developing the LocationFinder
-- When creating the frame, create a font string with some placeholder text
local playerLocationText = frame:CreateFontString(nil, "BACKGROUND", "GameFontNormal") -- or some other font
playerLocationText:SetText("PLAYER_POSITION") -- we should never see this text anyway
-- Add that font string as a property on the frame so that we can reference it later
addon.LocationFinderFrame.playerLocationText = playerLocationText
-- Whenever the frame is shown (on the "OnShow" event), start polling for player location
-- You can also stop polling whenever the frame is hidden ("OnHide")
addon:StartPollingLocation("location-frame")
-- Subscribe to this event to know whenever the player's location changed during the polling
addon.AppEvents:Subscribe("PlayerLocationChanged", function(loc)
local text = "" -- build whatever text you want to display using the loc
addon.LocationFinderFrame.playerLocationText:SetText(text)
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment