View Single Post
10-13-16, 07:40 PM   #6
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
It wouldn't be too bad, but using the event is much easier in addition to being lighter on resources.

Lua Code:
  1. local function HideUI()
  2.      UIParent:Hide()
  3. end
  4.  
  5. local f = CreateFrame("Frame")
  6. f:RegisterEvent("PLAYER_STOPPED_MOVING")
  7. f:RegisterEvent("PLAYER_STARTED_MOVING")
  8.  
  9. f:SetScript("OnEvent", function(self, event)
  10.      if event == "PLAYER_STOPPED_MOVING" then
  11.           C_Timer.After(3, HideUI)
  12.      end
  13.      if event == "PLAYER_STARTED_MOVING" then
  14.           UIParent:Show()
  15.      end
  16. end)
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote