View Single Post
10-31-06, 08:48 PM   #6
Global
A Flamescale Wyrmkin
 
Global's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2005
Posts: 95
I'm sure I'm doing this totally wrong, but I figure I should ask before I get too irritated. I'm trying to update my mod, Perl Classic, and I got the first step done (the secure buttons so you can target people). I have a bunch of blocked addon stuff going on in the background do to hide/showing of certain frames inside the mod, but that's fine and can be dealt with later.

The real issue I seem to be having right now is how to hide frames while in combat. Specifically, my Target and ToT frames.

I read the post and saw the easy mode and hard mode options. So I got the latest version of ag_UF and started digging for some real world examples. I'd like to say I learned something from looking at the code, but I really didn't. Here's what I ended up doing, for better or worse.

In my OnLoad function, I added in: RegisterUnitWatch(this, true);

And then for my events, I have this:

Code:
function Perl_Target_Events:PLAYER_TARGET_CHANGED()
	if (UnitExists("target")) then
		Perl_Target_Update_Once();		-- Set the unchanging info for the target
	else
		if (InCombatLockdown()) then
			-- Not sure what to do here
		else
			Perl_Target_Frame:Hide();		-- There is no target, hide the frame
		end
	end
end
And just for good measure, I dropped the same code into UNIT_TARGET since I'm not even sure what that event is used for.

Code:
function Perl_Target_Events:UNIT_TARGET()
	if (arg1 == target) then
		if (UnitExists("target")) then
			Perl_Target_Update_Once();		-- Set the unchanging info for the target
		else
			Perl_Target_Frame:Hide();		-- There is no target, hide the frame
		end
	end
end
I know I'm doing it all wrong, and trying to read Ace2 code and make it work in my style of coding is a little over my head. I'm using RegisterUnitWatch on a frame object in the XML and not inheriting any of the secure templates if that helps. I zipped up a copy of my code in case anyone wants to take a closer look. It can be found here: http://www.g-ball.com/wow/ui/pcuf_v7_lookingforhelp.zip

Any help or points into the right direction would be greatly appreciated.
  Reply With Quote