View Single Post
10-21-10, 11:09 AM   #7
Kagaro
A Cyclonian
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 45
Originally Posted by Luponius View Post
Been digging around for quite a while now, no results that worked, although I hope I'm picking a few good leads here... The issues I'm facing are to find the correct events that need be tested for to fire the conditions. The following is what I need, and what I found:

Checking if a target is selected
Code:
UNIT_TARGET	Fires when a unit's target changes
PLAYER_TARGET_CHANGED	Fires when the player changes targets
Technically, the description seems to indicate both may not be what I need. Still, if I can test to see if player_target_changed defaults to "no target" somehow I could use that as a "no target selected" event. I want this to happen similar to Pitbull, in fact exactly the same, "If target selected, set this alpha:" kind of concept. If you got the right one would appreciate help on this

Checking if player's in combat or not
Code:
PLAYER_REGEN_DISABLED	Fires when the player enters combat status
PLAYER_REGEN_ENABLED	Fires when the player leaves combat status
Quite positive that's right, the description is very straight forward here. Still need to figure out how multiple conditions are checked with AND and OR conditionals (Mostly need to figure out the right syntax for LUA)

Changing Color Settings:
Code:
OnLoad

local _, class = UnitClass("player");
	if class == "WARRIOR" then
        self.bg:SetVertexColor(0.95, 0.23, 0.23, self.bg:GetAlpha())
Sadly this is the part I barely got any information on. The above is all I could scrounge up which has a relation to changing alpha, and even then, this doesn't quite change the alpha but uses what's already there, if I am interpreting it correctly. Maybe it's something like self:SetAlpha(0.5) for setting visibility to 50% or something, and I'll have to give it a shot when I get some time.

I'd appreciate any help on any of the above, LUA is a first time thing for me, and researching seems to only get me so far without checking into the language itself. If nothing turns up and nobody has any idea on what I can attempt, I'll probably start looking into Pitbull4 code to see how target checks are carried out and how alpha values are set, in hopes of applying that to kgPanels.
self:SetAlpha()changes the frame, self.bg.SetVertexColor(...) was changing the color on the backgrund.
  Reply With Quote