View Single Post
06-15-10, 05:18 AM   #1
Haleth
This Space For Rent
 
Haleth's Avatar
Featured
Join Date: Sep 2008
Posts: 1,173
Two oUF questions.

Hello, I have two questions regarding oUF.

First one; I'm trying to colour my castbar icon border depending on whether or not the cast is interruptable. Red when it isn't, black when it is.

Here's the code:

Code:
			local bg = CreateFrame ("Frame", nil, iconFrame)
				bg:SetBackdrop( { 
				bgFile = "Interface\\ChatFrame\\ChatFrameBackground", 
			})


			local function castGlow(self, event, unit, interrupt)
				if(cb.NotInterruptible) then
					bg:SetBackdropColor(1, 0, 0)
				else
					bg:SetBackdropColor(0, 0, 0)
				end
			end

			self.PostCastStart = castGlow
			self.PostChannelStart = castGlow
I've tried a lot of variations on this, but no success. Mostly it's black, but sometimes it even turns white.

When I inverse the 'if not interruptible' function, it'll always be red.

--

Second one:

I regularly get an unpack error when oUF is trying to unpack the power colours, but can't find them somehow. For example, when I dismiss a vehicle, this error will pop up. It happens on other random events as well.

Code:
Interface\AddOns\oUF\elements\power.lua:22: bad argument #1 to 'unpack' (table expected, got nil)
Here's the relevant part in the lua file:

Code:
local Update = function(self, event, unit)

	if(self.unit ~= unit) then return end

	local _, UnitPowerType = UnitPowerType(unit)
	local pr, pg, pb = unpack(powercolors[UnitPowerType or "MANA"])
I use the colour in the following part:

Code:
	if(bar) then
			bar:SetStatusBarColor(pr, pg, pb)
		end
I've tried adding a check to it by changing it to this:

Code:
	if(bar) then
		if(self.Power) then
			bar:SetStatusBarColor(pr, pg, pb)
		else
			bar:SetStatusBarColor(1, 1, 0) -- just testing to see if this fixes a bug
		end
	end
But it doesn't help.

--

I'd greatly appreciate help with these two problems.
  Reply With Quote