Quantcast Objective Tracker - WoWInterface
Thread Tools Display Modes
06-13-15, 08:38 AM   #1
gempir
A Black Drake
 
gempir's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2015
Posts: 80
Objective Tracker

So Zork wrote a cool addon "rObjectiveTrackerMover"

The problem is me and another guy are having a bug where the ObjectiveTracker jumps in combat around. Weirdly, its not in every combat, I feel like its random, I couldn't figure how I recreate the problem.

Zork said he had problems before, he said it was fixed but the Issue is still sometimes occurring so I wanted to ask this smart forum.

This is basicly the important part of the code, I think

Lua Code:
  1. local function AdjustSetPoint(self,...)
  2.     local a1,af,a2,x,y = ...
  3.     if a1 and af == "MinimapCluster" and y ~= cfg.y then
  4.       if InCombatLockdown() then
  5.         self:SetPoint(a1,af,a2,x,cfg.y)
  6.       else
  7.         frame.point = {a1,af,a2,x,cfg.y}
  8.         frame:RegisterEvent("PLAYER_REGEN_ENABLED")
  9.       end
  10.     end
  11.   end
  12.  
  13.   frame:SetScript("OnEvent", function(self,event)
  14.     self:UnregisterEvent(event)
  15.     if event == "PLAYER_LOGIN" then
  16.       self.point = {ObjectiveTrackerFrame:GetPoint()}
  17.       hooksecurefunc(ObjectiveTrackerFrame, "SetPoint", AdjustSetPoint)
  18.     end
  19.     if InCombatLockdown() then
  20.       ObjectiveTrackerFrame:SetPoint(unpack(self.point))
  21.     end
  22.   end)


I think the problem is something with "If InCombatLockdown()" so my question is, how do I fix this bug of the ObjectiveTracker moving back to its position in Combat.

Last edited by gempir : 06-13-15 at 08:44 AM.
  Reply With Quote
06-13-15, 09:42 AM   #2
Clamsoda
A Frostmaul Preserver
Join Date: Nov 2011
Posts: 269
Lua Code:
  1. local function noop() end
  2.  
  3. ObjectiveTrackerFrame:ClearAllPoints()
  4. ObjectiveTrackerFrame:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", 0, -300)
  5. ObjectiveTrackerFrame.ClearAllPoints = noop
  6. ObjectiveTrackerFrame.SetPoint       = noop
  7. ObjectiveTrackerFrame:SetHeight(500)

This is the code I have been using to relocate my objective tracker. No need for any events or anything; ObjectiveTrackerFrame exists at file scope; furthermore I haven't had ANY issues with taint via setting ClearAllPoints and SetPoint to a dummy function.

Obviously you are interested in the SetPoint line that has position arguments.
  Reply With Quote
06-13-15, 11:58 AM   #3
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,289
I would not suggest to use either of the code. The first one simply doesn't handle the SetPoint hooks, which happens when boss or arena frames appera, or when you enable/disable the Blizzard side bars. The second one is a taint hazzard.

Try this code:

Lua Code:
  1. local moving
  2. hooksecurefunc(ObjectiveTrackerFrame, "SetPoint", function(self)
  3.     if moving then
  4.         return
  5.     end
  6.     moving = true
  7.     self:SetMovable(true)
  8.     self:SetUserPlaced(true)
  9.     self:ClearAllPoints()
  10.     self:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
  11.     self:SetScale(1.1) -- optional
  12.     self:SetWidth(300) -- optional
  13.     self:SetHeight(400) -- optional
  14.     self:SetMovable(false)
  15.     moving = nil
  16. end)

Also keep that in mind if the original parent of the frame aka the "MinimapCluster" is not in it's original position, then the client won't be able to bypass secure code for it's children frame aka the "ObjectiveTrackerFrame" and you won't be able to click on the quest items on the frame.

The only solution is that to reset the "MinimapCluster", or to use another 3rd party Minimap addon, which you can reposition securely/properly.

Last edited by Resike : 06-13-15 at 12:02 PM.
  Reply With Quote
06-13-15, 12:19 PM   #4
gempir
A Black Drake
 
gempir's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2015
Posts: 80
How far is the 2nd code from Clamsoda a taint hazzard?

The Quests are clickable and the quest tracker has the correct position
  Reply With Quote
06-13-15, 02:08 PM   #5
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,722
You're calling :SetPoint() in your :SetPoint() hook, Resike. That'll make an infinite loop.

In WFWW, I create a container frame, parent the objective tracker to that, and move/size the container. Then I do this, to avoid the recursive :SetPoint call...
Lua Code:
  1. local cap = ObjectiveTrackerFrame.ClearAllPoints
  2.     local sp = ObjectiveTrackerFrame.SetPoint
  3.     hooksecurefunc(ObjectiveTrackerFrame, "SetPoint", function(self)
  4.         cap(self)
  5.         sp(self, "TOPLEFT", 30, -10)
  6.     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
06-13-15, 02:11 PM   #6
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,289
Originally Posted by Seerah View Post
You're calling :SetPoint() in your :SetPoint() hook, Resike. That'll make an infinite loop.

In WFWW, I create a container frame, parent the objective tracker to that, and move/size the container. Then I do this, to avoid the recursive :SetPoint call...
Lua Code:
  1. local cap = ObjectiveTrackerFrame.ClearAllPoints
  2.     local sp = ObjectiveTrackerFrame.SetPoint
  3.     hooksecurefunc(ObjectiveTrackerFrame, "SetPoint", function(self)
  4.         cap(self)
  5.         sp(self, "TOPLEFT", 30, -10)
  6.     end)
It's not infinite because of the moving variable.
  Reply With Quote
06-13-15, 02:17 PM   #7
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,289
Originally Posted by gempir View Post
How far is the 2nd code from Clamsoda a taint hazzard?

The Quests are clickable and the quest tracker has the correct position
There is nothing wrong with it, but it could potentionally spread taint for other addons. Also it's not the best method to permanently kill a function, since you can't really restore it only by deleting the code itself.
  Reply With Quote
06-13-15, 03:07 PM   #8
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,722
Originally Posted by Resike View Post
It's not infinite because of the moving variable.
Bah, I guess my eyes glazed over for that bit. ><
__________________
"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

WoWInterface » Developer Discussions » Lua/XML Help » Objective Tracker

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off