View Single Post
10-23-16, 02:46 PM   #25
Krainz
A Wyrmkin Dreamwalker
Join Date: Oct 2016
Posts: 57
It's fantastic. Truly amazing work there, tonyis3l33t.

Originally Posted by tonyis3l33t View Post
Note this one doesn't do the show-while-moving, the show-while-mouselooking, or the hide-after-not-moving-mouse stuff.
I tried implementing that by expanding the big if statement and merging it with MunkDev's code:

lua Code:
  1. addon.timer = 0
  2. addon:SetScript("OnUpdate", function(self, elapsed)
  3.         self.timer = self.timer + elapsed
  4.         local speed = GetUnitSpeed("player");
  5.         local x, y = GetCursorPosition();
  6.         if self.x ~= x
  7.         or self.y ~= y
  8.         or UnitAffectingCombat("Player")
  9.         or InCombatLockdown()
  10.         or speed ~=0
  11.         or UnitName("mouseover")
  12.         or ChatFrame1EditBox:IsShown()
  13.         or WorldMapFrame:IsShown()
  14.         or MailFrame:IsShown()
  15.         or GossipFrame:IsShown()
  16.         or GameTooltipTextLeft1:GetText()
  17.         or UnitCastingInfo("Player")
  18.         or UnitChannelInfo("Player")
  19.         or UnitExists("Target") then
  20.             addon:FadeIn();
  21.         elseif not IsMouselooking() then
  22.             self.timer = 0
  23.             addon:FadeOut();
  24.         end;
  25.         if self.timer > 5 then
  26.             -- check mouse looking here since the cursor position is static while
  27.             -- holding down right mouse button, also check that you're not mousing
  28.             -- over a frame since that may not be desirable either
  29.             if not IsMouselooking() and GetMouseFocus() == WorldFrame then
  30.                 self.x = x
  31.                 self.y = y
  32.             end
  33.            
  34.             self.timer = 0
  35.         end
  36. end)

Needs more testing though.

Last edited by Krainz : 10-23-16 at 02:56 PM.
  Reply With Quote