Thread Tools Display Modes
04-25-09, 03:17 AM   #1
sacrife
An Onyxian Warder
 
sacrife's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 384
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)
  Reply With Quote
04-25-09, 06:53 AM   #2
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
show the code you use to spawn raid groups
  Reply With Quote
04-25-09, 07:10 AM   #3
sacrife
An Onyxian Warder
 
sacrife's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 384
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
  Reply With Quote
04-25-09, 07:26 AM   #4
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Originally Posted by sacrife View Post
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

Last edited by p3lim : 04-25-09 at 07:30 AM.
  Reply With Quote
04-25-09, 11:23 AM   #5
sacrife
An Onyxian Warder
 
sacrife's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 384
Error: Attempt to call global 'GetAttribute' (a nil value)

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

Last edited by sacrife : 04-25-09 at 11:34 AM.
  Reply With Quote
04-26-09, 06:12 AM   #6
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Originally Posted by sacrife View Post
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.
  Reply With Quote
04-26-09, 06:33 AM   #7
sacrife
An Onyxian Warder
 
sacrife's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 384
Is there an easy way to change the color of the groupnumber I'm in?
I tried, but could'nt really make it work.
  Reply With Quote
04-27-09, 09:28 AM   #8
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Originally Posted by sacrife View Post
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'
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Raidgroup # Display.


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off