WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   oUF (Otravi Unit Frames) (https://www.wowinterface.com/forums/forumdisplay.php?f=87)
-   -   Party spawn error in my layout (https://www.wowinterface.com/forums/showthread.php?t=34127)

Toran 07-23-10 12:45 PM

Toggle party in raid - error
 
oUF gurus,

I am setting up my oUF layout and getting an error. Any help with my logic here would be great. This is not an oUF 1.4 compatible layout, will do that soon.

Error:
layout.lua:1463: attempt to index global 'party' (a nil value)

I highlighted and bolded line 1463 in red. This is the "party toggle in raid" section, which is causing the problems.



Code:

       
        --
        -- party
        --


        if(not (playerClass=="PRIEST") and (showparty == true)) then
                local party = oUF:Spawn("header", "oUF_Party")
                party:SetManyAttributes(
                "showParty", true,
                "showSolo", false,
                "yOffset", 105)
                party:SetPoint("TOPLEFT", player, -245, 25)
                --party:SetAttribute("showRaid", true)
               
        end


        --
        -- partypets
        --
       
        if(not (playerClass=="PRIEST") and (showpartypets == true)) then
                local partypet = {}
                partypet[1] = oUF:Spawn('partypet1', 'oUF_PartyPet1')
                partypet[1]:SetPoint('TOPLEFT', party, 'TOPLEFT', -75, 0)
                for i =2, 4 do
                        partypet[i] = oUF:Spawn('partypet'..i, 'oUF_PartyPet'..i)
                        partypet[i]:SetPoint('TOP', partypet[i-1], 'BOTTOM', 0, 105)
                end
        end


        --
        -- raid
        --

        if (not(playerClass=="PRIEST") and (showraid == true)) then
                local raid = {} -- group 1-5 only
                for i = 1, 5 do
                table.insert(raid, oUF:Spawn("header", "oUF_Raid"..i))
                if i == 1 then
                raid[i]:SetPoint("LEFT", UIParent, "LEFT", 25, -25)
                else
                raid[i]:SetPoint("CENTER", raid[i-1], "CENTER", 0, -42)   
                end

                raid[i]:SetManyAttributes(   
                --"showParty", false,
                "showPlayer", true, 
                "showRaid", true, 
                "showSolo", false,
                "columnSpacing", 10,  -- default was 8
                "unitsPerColumn", 1, 
                "maxColumns", 5, 
                "columnAnchorPoint", "LEFT", 
                "xOffset", 12, 
                "groupFilter", i )
                                               
                end
        end
       


        --
        -- party toggle in raid
        --
       
        if (not (playerClass=="PRIEST")) then
                local partyToggle = CreateFrame('Frame')
                partyToggle:RegisterEvent('PLAYER_LOGIN')
                partyToggle:RegisterEvent('RAID_ROSTER_UPDATE')
                partyToggle:RegisterEvent('PARTY_LEADER_CHANGED')
                partyToggle:RegisterEvent('PARTY_MEMBERS_CHANGED')
                partyToggle:SetScript('OnEvent', function(self)
                        if InCombatLockdown() then
                                self:RegisterEvent("PLAYER_REGEN_ENABLED")
                        else
                                self:UnregisterEvent("PLAYER_REGEN_ENABLED")
                                local numraid = GetNumRaidMembers()
                                if numraid > 5 then
                                        if showparty == true then                       
                                                party:Hide()
                                        end
                                        if showraid == true then
                                                raid:Show()
                                        end
                                else
                                        if showparty == true then                       
                                                party:Show()
                                        end
                                        if showraid == true then
                                                raid:Hide()
                                        end
                                end
                        end
                end)
        end

My entire layout if this helps: http://pastey.net/138864

Thanks!!

Dawn 07-23-10 01:55 PM

Try to wrap

Code:

if(not (playerClass=="PRIEST") and (showparty == true)) then

...

end

around your

Code:

Party:Hide/Show()
and remove it from the party and raid spawn, this might help.

Toran 07-23-10 02:06 PM

Dawn, tried that and get an error:

layout.lua:1467: attempt to call method 'Hide' (a nil value)

This refers to the last "raid:Hide()" call. Hmmm.

Sojik 07-23-10 02:32 PM

Quote:

Originally Posted by Toran (Post 199745)
This is not an oUF 1.4 compatible layout, will do that soon.

How soon? Because this is very easy to fix in 1.4.

Toran 07-23-10 02:33 PM

Quote:

Originally Posted by Sojik (Post 199773)
How soon? Because this is very easy to fix in 1.4.

I wasn't sure where to start. Checked Zork's guide, but couldn't match things up well to my (old) layout. Any suggestions?

Sojik 07-23-10 02:38 PM

I just rewrote my layout from scratch borrowing heavily from oUF_Freeb and oUF_Freebgrid, personally.

Toran 07-23-10 04:23 PM

Fixed. Didn't need all the raid conditionals in the party hide/show section. Thanks.

Toran 07-24-10 03:05 PM

Quote:

Originally Posted by Sojik (Post 199776)
I just rewrote my layout from scratch borrowing heavily from oUF_Freeb and oUF_Freebgrid, personally.

Wish I had the time. :( Might try at some point, but will use my old layout until it breaks.

haste 07-24-10 10:42 PM

If you use frequent update tags, then I'd urge you to update to 1.4. There's a pretty bad performance regression in 1.3.x.


All times are GMT -6. The time now is 04:25 AM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI