Thread Tools Display Modes
01-25-13, 02:46 AM   #1
lynce
A Cyclonian
 
lynce's Avatar
Join Date: Jul 2008
Posts: 48
Quest tracker

Ok im looking for a way to automatically hide the tracker when joining a group/raid, and make it reappear upon leaving. Feel free to come with suggestions. Thanks

Last edited by lynce : 01-27-13 at 04:30 PM.
  Reply With Quote
01-25-13, 04:28 AM   #2
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,360
Who Framed Watcher Wabbit can - according to the feature list - "automatically collapse the tracker when entering an instance or during pet battles".

Maybe that's a suitable alternative?
  Reply With Quote
01-26-13, 01:33 AM   #3
lynce
A Cyclonian
 
lynce's Avatar
Join Date: Jul 2008
Posts: 48
Yes it has to be something like that. But I really don't want to use that addon, because I don't need that other stuff. Just as simple as possible. I looked through the code but didn't find anything. Suggestions?
  Reply With Quote
01-26-13, 05:14 AM   #4
pelf
Sentient Plasmoid
 
pelf's Avatar
Premium Member
Join Date: May 2008
Posts: 133
Well, if that addon does what you want, you could just see how it does it and duplicate that portion into a small addon, no?
  Reply With Quote
01-26-13, 12:13 PM   #5
lynce
A Cyclonian
 
lynce's Avatar
Join Date: Jul 2008
Posts: 48
Code:
instance = {
			name = "Collapse in instance",
			desc = "Automatically collapses the watch frame when entering an instance.",
			type = "toggle",
			get = function() return db.instance end,
			set = function()
						db.instance = not db.instance
						if db.instance then
							WFContainer:RegisterEvent("PLAYER_ENTERING_WORLD")
						else
							WFContainer:UnregisterEvent("PLAYER_ENTERING_WORLD")
						end
					end,
			order = 15.2,
This was the only thing i could find in the addon that seems to have something to do with it. But i don't know how i can use this to make it work. And as it says, it only collapses the frame. I want it hidden completely. I would very much appreciate some help
  Reply With Quote
01-26-13, 01:00 PM   #6
pelf
Sentient Plasmoid
 
pelf's Avatar
Premium Member
Join Date: May 2008
Posts: 133
This is the code block you're looking for:
Code:
function(_,event,...)
	if event == "PLAYER_ENTERING_WORLD" then
		if IsInInstance() and not WFWWPCDB.collapsed then
			--if you go in the instance and the WF isn't collapsed...
			WatchFrameCollapseExpandButton:Click()	--collapse
		end
	elseif event == "PET_BATTLE_OPENING_START" and not WFWWPCDB.collapsed then
		notCollapsed = true
		WatchFrameCollapseExpandButton:Click()
	elseif event == "PET_BATTLE_CLOSE" and notCollapsed then
		notCollapsed = false
		WatchFrameCollapseExpandButton:Click()
	elseif event == "CVAR_UPDATE" then
		local cvar,value = ...
		if cvar == "WATCH_FRAME_WIDTH_TEXT" then
			if not WatchFrame.userCollapsed then
				if value == "1" then
					WFContainer:SetWidth(350)
				else
					WFContainer:SetWidth(250)
				end
			end
			wideFrame = value
		end
	else
		local index = ...
		if event == "QUEST_AUTOCOMPLETE" or index == 0 then
			if WFWWPCDB.collapsed then
				WFContainer:SetHeight(db.height)
				if wideFrame == "1" then
					WFContainer:SetWidth(350)
				else
					WFContainer:SetWidth(250)
				end
				WFWWPCDB.collapsed = false
			end
		end
	end
end
Those are the events it responds to and what it does when they fire.

For the hiding the tracker while in an instance thing, it's two parts:
  1. A flag indicating whether the watch frame is expanded.
  2. Checking that and toggling the watch frame if IsInInstance().
In order to keep the frame in sync with the flag, the Expand function on the watch frame is hooked:
Code:
hooksecurefunc(
	"WatchFrame_Expand",
	function(self)
		if WFWWPCDB.collapsed and GetNumAutoQuestPopUps() == 0 then
			WatchFrame_Collapse(self)
		end
	end
)
The default OnClick script is replaced with one that wraps the existing function and toggles the flag when the frame is toggled.
  Reply With Quote
01-26-13, 01:54 PM   #7
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Originally Posted by nazrhyn View Post
Well, if that addon does what you want, you could just see how it does it and duplicate that portion into a small addon, no?
Except WFWW is All Rights Reserved. If someone wants to use my code, they need to ask, and I prefer that they use it for inspiration or a learning tool rather than just ripping it out.
__________________
"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
01-26-13, 05:03 PM   #8
pelf
Sentient Plasmoid
 
pelf's Avatar
Premium Member
Join Date: May 2008
Posts: 133
I imagine there aren't too many ways to implement the collapse-watch-frame-when-zoning-into-instance thing. Anyone else writing that is probably going to end up with code pretty similar to what's in there.

I suppose, past the event handling, someone could've gone down the path of examining the watch frame to determine if it's collapsed or expanded rather than doing what you did to maintain a flag.

Ultimately, I guess I'm curious as to what amount of your implementation is enough to be violating the terms under which you released it. If someone: (1) handled PLAYER_ENTERING_WORLD and checked IsInInstance(), (2) hooked the Expand function on the WatchFrame, and (3) overrode OnClick for the button frame ... in another addon, would that be violating your terms?
  Reply With Quote
01-26-13, 05:08 PM   #9
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Originally Posted by Seerah View Post
use it for inspiration or a learning tool rather than just ripping it out.
This is what I said, and this doesn't refute what you just said.
__________________
"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
01-26-13, 05:31 PM   #10
pelf
Sentient Plasmoid
 
pelf's Avatar
Premium Member
Join Date: May 2008
Posts: 133
Originally Posted by Seerah View Post
This is what I said, and this doesn't refute what you just said.
Well, forgive me, but, that doesn't answer my question.
  Reply With Quote
01-26-13, 06:30 PM   #11
lynce
A Cyclonian
 
lynce's Avatar
Join Date: Jul 2008
Posts: 48
Please, take that discussion in another thread. I made this post because I have limited lua experience, and I don't even know where to start to make this work. If I have to copy someone else's code, I will ask for permission.
  Reply With Quote
01-27-13, 12:39 AM   #12
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by nazrhyn View Post
Ultimately, I guess I'm curious as to what amount of your implementation is enough to be violating the terms under which you released it. If someone: (1) handled PLAYER_ENTERING_WORLD and checked IsInInstance(), (2) hooked the Expand function on the WatchFrame, and (3) overrode OnClick for the button frame ... in another addon, would that be violating your terms?
The answer to that is pretty obvious to anyone with any understanding of copyright law. Copyright protects only the implementation, not the idea or process.

For example, there are only so many ways you can make a chocolate chip cookie. Copyright protects the actual text you write in your version of the recipe (eg. "Crack the eggs into the bowl and whisk them until combined.") but anyone else is free to write their own recipe for chocolate chip cookies. Even though the ingredients and process are basically the same, as long as they write their own text, there is no copyright issue.

Similarly, copyright protects the actual text of Harry Potter and Twilight, but anyone is free to write stories about boys going to wizard school and sparkly vampires stalking high school girls.

Anyway, here is a simple way to unconditionally hide the quest tracker while you are in a group:

Code:
local f = CreateFrame("Frame")
f:RegisterEvent("GROUP_ROSTER_UPDATE")
f:SetScript("OnEvent", function()
    if IsInGroup() then
        WatchFrame:Hide()
        WatchFrame.Show = WatchFrame.Hide
    else
        WatchFrame.Show = nil
        WatchFrame:Show()
    end
end)
If you need help turning the above code into an addon, copy and paste it into this page:
http://addon.ziuo.net/
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
01-27-13, 02:44 AM   #13
pelf
Sentient Plasmoid
 
pelf's Avatar
Premium Member
Join Date: May 2008
Posts: 133
Originally Posted by Phanx View Post
The answer to that is pretty obvious to anyone with any understanding of copyright law. Copyright protects only the implementation, not the idea or process.
Then, what I'm not seeing is why it was necessary to even mention the terms under which the source was published. I assume it had something to do with my use of the word "duplicate"; but, from my perspective, I was just telling someone to check out how addon X does Y so they could figure out how to implement it.
  Reply With Quote
01-27-13, 06:11 AM   #14
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
I wasn't part of the original discussion, but if you go back and read the posts, it does sound like the suggestion was basically "just copy and paste that part into a new addon", so I don't see any issue with Seerah -- the code's author -- pointing out that you can't do that.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
01-27-13, 10:17 AM   #15
lynce
A Cyclonian
 
lynce's Avatar
Join Date: Jul 2008
Posts: 48
Thanks again Phanx. It seems to do the trick=)

Last edited by lynce : 01-27-13 at 04:30 PM.
  Reply With Quote
01-27-13, 05:59 PM   #16
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Thanks for the explanations, Phanx. That is, indeed, how I took it and what I meant.

Glad you got what you needed, lynce!
__________________
"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 » AddOns, Compilations, Macros » AddOn Help/Support » Quest tracker


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