WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   oUF (Otravi Unit Frames) (https://www.wowinterface.com/forums/forumdisplay.php?f=87)
-   -   Raidgroup # Display. (https://www.wowinterface.com/forums/showthread.php?t=22851)

sacrife 04-25-09 03:17 AM

Raidgroup # Display.
 
Hi.
I've been trying to the raidgroup number of my raidgroups next to the raidframe, and I seem to have some problems creating the fontstrings.
Here's what I have so far.

Code:

if (GetNumRaidMembers() > 0) then
        local raidGroupYpos = -30
        local raidGroupXpos = 5
        local raidGroup1Text = CreateFontString(nil, "OVERLAY")
                raidGroup1Text:SetPoint("LEFT", UIParent, raidGroupXpos, raidGroupYpos)
        local raidGroup2Text = CreateFontString(nil, "OVERLAY")
                raidGroup2Text:SetPoint("LEFT", UIParent, raidGroupXpos, raidGroupYpos-10)
        local raidGroup3Text = CreateFontString(nil, "OVERLAY")
                raidGroup2Text:SetPoint("LEFT", UIParent, raidGroupXpos, raidGroupYpos-20)
        local raidGroup4Text = CreateFontString(nil, "OVERLAY")
                raidGroup2Text:SetPoint("LEFT", UIParent, raidGroupXpos, raidGroupYpos-30)
        local raidGroup5Text = CreateFontString(nil, "OVERLAY")
                raidGroup2Text:SetPoint("LEFT", UIParent, raidGroupXpos, raidGroupYpos-40)
        local raidGroup6Text = CreateFontString(nil, "OVERLAY")
                raidGroup2Text:SetPoint("LEFT", UIParent, raidGroupXpos, raidGroupYpos-50)
        local raidGroup7Text = CreateFontString(nil, "OVERLAY")
                raidGroup2Text:SetPoint("LEFT", UIParent, raidGroupXpos, raidGroupYpos-60)
        local raidGroup8Text = CreateFontString(nil, "OVERLAY")
                raidGroup2Text:SetPoint("LEFT", UIParent, raidGroupXpos, raidGroupYpos-70)
       
        self:SetWidth(10)
        self:SetHeight(13)
        self:SetTextColor(1, 1, 1)
        self:SetFont("Interface\\AddOns\\!LynSettings\\fonts\\font2.ttf", 16, "OUTLINE")
       
        self:SetScript("OnUpdate", self.update)
       
    for i=1, MAX_RAID_MEMBERS do
               
        local _, _, subgroup, _, _, _, _, _, _ = GetRaidRosterInfo(i); --[[name, rank, subgroup, level, class, fileName, zone, online, isDead]]--
               
        if (subgroup == 1)then
                        raidGroup1Text:SetText(subgroup)
                else
                        raidGroup1Text:SetText("")
                end
               
                if (subgroup == 2) then
                        raidGroup2Text:SetText(subgroup)
                else
                        raidGroup2Text:SetText("")
        end

    end

end

Any ideas?

Error: Attempt to call global a nil value.

(this is at the end of my ouf_layout, design file though)

p3lim 04-25-09 06:53 AM

show the code you use to spawn raid groups

sacrife 04-25-09 07:10 AM

Code:

-- Raid frames
local Raid = {}
for i=1,8 do -- number of Raid-Groups, here 8
        local raidGroup = oUF:Spawn('header', 'oUF_Raid'..i)
        raidGroup:SetManyAttributes('groupFilter', tostring(i), 'showRaid', true, 'xOffSet', 5, 'POINT', 'LEFT')
        table.insert(Raid, raidGroup)
        if(i==1) then
                raidGroup:SetPoint('TOPLEFT', UIParent, 'LEFT', 10, 100) -- position of first raidgroup
        else
                raidGroup:SetPoint('BOTTOMLEFT', Raid[i-1], 'BOTTOMLEFT', 0, -30)
        end
       
        local raidtoggle = CreateFrame"Frame"
        raidtoggle:RegisterEvent"PARTY_MEMBERS_CHANGED"
    raidtoggle:RegisterEvent"PARTY_LEADER_CHANGED"
    raidtoggle:RegisterEvent"RAID_ROSTER_UPDATE"
    raidtoggle:RegisterEvent"PLAYER_LOGIN"
        raidtoggle:SetScript("OnEvent", function(self, event, ...)
        inInstance, instanceType = IsInInstance()
                if (instanceType == "arena") then
                raidGroup:Hide()
                else
            raidGroup:Show()
                end
        end)
end


p3lim 04-25-09 07:26 AM

Quote:

Originally Posted by sacrife (Post 131006)
Code:

-- Raid frames
local Raid = {}
for i=1,8 do -- number of Raid-Groups, here 8
        local raidGroup = oUF:Spawn('header', 'oUF_Raid'..i)
        raidGroup:SetManyAttributes('groupFilter', tostring(i), 'showRaid', true, 'xOffSet', 5, 'POINT', 'LEFT')
        table.insert(Raid, raidGroup)
        if(i==1) then
                raidGroup:SetPoint('TOPLEFT', UIParent, 'LEFT', 10, 100) -- position of first raidgroup
        else
                raidGroup:SetPoint('BOTTOMLEFT', Raid[i-1], 'BOTTOMLEFT', 0, -30)
        end
       
        local raidtoggle = CreateFrame"Frame"
        raidtoggle:RegisterEvent"PARTY_MEMBERS_CHANGED"
    raidtoggle:RegisterEvent"PARTY_LEADER_CHANGED"
    raidtoggle:RegisterEvent"RAID_ROSTER_UPDATE"
    raidtoggle:RegisterEvent"PLAYER_LOGIN"
        raidtoggle:SetScript("OnEvent", function(self, event, ...)
        inInstance, instanceType = IsInInstance()
                if (instanceType == "arena") then
                raidGroup:Hide()
                else
            raidGroup:Show()
                end
        end)
end


inside the layout function:
Code:

if(self:GetParent():GetName():match('oUF_Raid')) then
  for i = 1, 8 do
      local groupNumber = self.Health:CreateFontString(nil, 'OVERLAY')
      groupNumber:SetText(GetAttribute('groupFilter'))
      groupNumber:SetPoint('anchor1', oUF_Raid..i, 'anchor2', x, y)
  end
end

add placement and a font then try it out

sacrife 04-25-09 11:23 AM

Error: Attempt to call global 'GetAttribute' (a nil value)

Edit: Nevermind, I changed it to groupNumber:SetText(i).
Works like a charm.

p3lim 04-26-09 06:12 AM

Quote:

Originally Posted by sacrife (Post 131054)
Error: Attempt to call global 'GetAttribute' (a nil value)

Edit: Nevermind, I changed it to groupNumber:SetText(i).
Works like a charm.

D'oh! forgot the 'self:' before 'GetAttribute', but using the index number uses less resources.

sacrife 04-26-09 06:33 AM

Is there an easy way to change the color of the groupnumber I'm in?
I tried, but could'nt really make it work.

p3lim 04-27-09 09:28 AM

Quote:

Originally Posted by sacrife (Post 131223)
Is there an easy way to change the color of the groupnumber I'm in?
I tried, but could'nt really make it work.

make a table of colors and use the lua API 'unpack'


All times are GMT -6. The time now is 06:10 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI