1. #1

    oUF Aura Anchoring

    I'm trying to edit an oUF layout to get the auras positioned how I want them - up to 2 rows of buffs, with debuffs anchored beneath the buffs, or to the frame if the target has no buffs. I'm working with the oUF layout from Tukui, but having a bit of trouble with the code. Pretty sure I'm on the right track, but I'm getting an LUA error and I don't know how to fix it.

    Code:
     if (unit == "target" and db.targetauras) or (unit == "player" and db.playerauras) then
                local function numbuffs()
                    local numbuffs, i = 0, 1
                    while true do
                        local name = UnitBuff("target", i)
                        if not name then
                            break
                        else
                            numbuffs = numbuffs + 1
                        end
                        i = i + 1
                    end
                    return numbuffs
                end
                local buffs = CreateFrame("Frame", nil, self)
                local debuffs = CreateFrame("Frame", nil, self)
                f:RegisterEvent("UNIT_AURA")
                f:SetScript("OnEvent", function()
                    if numbuffs() > 9 then
                        buffs:SetHeight(52)
                        buffs.num = 18
                    elseif numbuffs() > 0 then
                        buffs.SetHeight(26)
                        buffs.num = 9
                    else
                        buffs:SetHeight(0)
                        buffs.num = 9
                end)
    
    --            buffs:SetHeight(26)
                buffs:SetWidth(252)
                buffs:SetPoint("TOPLEFT", self, "BOTTOMLEFT", 0, -3)
                buffs.size = 26
    --            buffs.num = 9
                debuffs:SetHeight(26)
                debuffs:SetWidth(252)
                debuffs:SetPoint("TOPLEFT", buffs, "BOTTOMLEFT", 0, -5)
                debuffs.size = 26
                debuffs.num = 27
                buffs.spacing = 2
                buffs.initialAnchor = 'TOPLEFT'
                buffs["growth-y"] = "DOWN"
                buffs["growth-x"] = "RIGHT"
                buffs.PostCreateIcon = TukuiDB.PostCreateAura
                buffs.PostUpdateIcon = TukuiDB.PostUpdateAura
                self.Buffs = buffs    
                debuffs.spacing = 2
                debuffs.initialAnchor = 'TOPLEFT'
                debuffs["growth-y"] = "DOWN"
                debuffs["growth-x"] = "RIGHT"
                debuffs.PostCreateIcon = TukuiDB.PostCreateAura
                debuffs.PostUpdateIcon = TukuiDB.PostUpdateAura
                self.Debuffs = debuffs
            end
    The error I'm getting is
    Code:
    Message: Interface\AddOns\Tukui\unitframes\layout.lua:595: unexpected symbol near ')'
    Time: 02/07/11 07:53:59
    Count: 1
    Stack:
    Locals:
    Line 595 is the end of the SetScript, at end).

    Seems really simple but, for the life of me, I can't get it to work. Am I way off base or on the right track? Thanks in advance.

  2. #2
    Deleted
    Code:
     f:SetScript("OnEvent", function()
                    if numbuffs() > 9 then
                        buffs:SetHeight(52)
                        buffs.num = 18
                    elseif numbuffs() > 0 then
                        buffs.SetHeight(26)
                        buffs.num = 9
                    else
                        buffs:SetHeight(0)
                        buffs.num = 9
                end)
    Code:
     f:SetScript("OnEvent", function()
                    if numbuffs() > 9 then
                        buffs:SetHeight(52)
                        buffs.num = 18
                    elseif numbuffs() > 0 then
                        buffs.SetHeight(26)
                        buffs.num = 9
                    else
                        buffs:SetHeight(0)
                        buffs.num = 9
                    end
                end)

  3. #3
    Thanks! That works, although it is now apparent I should also register target change.

    Thanks again Treeston. I promise once I can link images you won't have to reformat into a thumbnail for a single one of mine.
    Last edited by Darckli; 2011-02-08 at 08:18 AM.

  4. #4
    Deleted
    * Treeston is now a happy tauren.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •