View Single Post
01-07-14, 11:18 PM   #64
10leej
A Molten Giant
 
10leej's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2011
Posts: 583
Originally Posted by Phanx View Post
(1) Add somewhere:
Code:
local function Buffs_PostUpdate = function(element, unit)
	local rows = ceil(element.visibleBuffs / element.iconsPerRow)
	element:SetHeight(rows * (element.size + element.spacing)
end
(2) In your spawn function, add the green bits, remove the blue ones:
Code:
        Buffs:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 0, 1)
        Buffs:SetPoint("BOTTOMRIGHT", self, "TOPRIGHT", 0, 1)
        Buffs:SetPoint'LEFT'
        Buffs:SetPoint'RIGHT'
        Buffs:SetHeight(cfg.Buffs.size + cfg.Buffs.spacing)

        Buffs.iconsPerRow = floor(self:GetWidth() / (cfg.Buffs.size + cfg.Buffs.spacing) + 0.5)
        Buffs.PostUpdate = Buffs_PostUpdate

        Debuffs:SetPoint("BOTTOMLEFT", Buffs, "TOPLEFT")
        Debuffs:SetPoint("BOTTOMRIGHT", Buffs, "TOPRIGHT")
        Debuffs:SetPoint'LEFT'
        Debuffs:SetPoint'RIGHT'
oUF offers tons of hooks for elements -- you should really spend some time reading the oUF element code to see what's available. Pretty much every element has at least a PreUpdate and PostUpdate (or an Override if you want to control the whole update yourself) and many elements have more.
Still doesn't work right. Though I don;t see why call SetPoint twice

Got this error
Code:
1x oUF_Bob-1\modules\units.lua:483: "(" expected near "="


Locals:
function script
buff script

I'll browse oUF see what's there figured I;d post that here because you would probably answer before I find something. Mostly because your awesome like that Phanx

EDIT:
Shouldn't the function be like this rather than calling function twice in the same line?

Code:
local function Buffs_PostUpdate(element, unit)
	local rows = ceil(element.visibleBuffs / element.iconsPerRow)
	element:SetHeight(rows * (element.size + element.spacing))
end
__________________
Tweets YouTube Website

Last edited by 10leej : 01-07-14 at 11:23 PM.
  Reply With Quote