Thread Tools Display Modes
12-29-10, 06:11 AM   #1
Sniffles
A Black Drake
 
Sniffles's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2010
Posts: 86
Buff Frames are skinned but i get .LUA Errors

Hey wowinterface community

I tried to skin my Buff Frames. My code works but i get a LUA Error

Code:
Message: Interface\AddOns\Sniffles Buffs\buffs.lua:6: attempt to index field '?' (a nil value)
Time: 12/29/10 13:03:10
Count: 1
Stack: Interface\AddOns\Sniffles Buffs\buffs.lua:6: in function <Interface\AddOns\Sniffles Buffs\buffs.lua:4>
[C]: in function `BuffFrame_UpdateAllBuffAnchors'
Interface\FrameXML\BuffFrame.lua:107: in function `BuffFrame_Update'
Interface\FrameXML\BuffFrame.lua:127: in function `BuffFrame_UpdatePositions'
[string "*:OnLoad"]:4: in function `setFunc'
Interface\FrameXML\InterfaceOptionsPanels.lua:1941: in function <Interface\FrameXML\InterfaceOptionsPanels.lua:1935>
Here is my Code:
Code:
local _G = _G
font, fsize, ftags = [[Interface\AddOns\oUF_Sniffles\media\fonts\font1.ttf]], 14, 'THINOUTLINE'

local function bufz()
	for i = 1, 32 do
		_G["BuffButton"..i]:SetHeight(30)
		_G["BuffButton"..i]:SetWidth(30)
		CreateBorder(_G["BuffButton"..i], 12, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
		
		_G["BuffButton"..i.."Count"]:SetFont(font, fsize, ftags)
		_G["BuffButton"..i.."Duration"]:SetFont(font, fsize, ftags)
		_G["BuffButton"..i.."Duration"]:SetPoint("BOTTOM", _G["BuffButton"..i], 0, -15)
		if _G["BuffButton"..i.."Border"] then _G["BuffButton"..i.."Border"]:Hide() end
	end
end

hooksecurefunc("AuraButton_Update", bufz)
Here the Screenshot:


Thank you in advance
Sniffles.
  Reply With Quote
12-29-10, 07:22 AM   #2
Haleth
This Space For Rent
 
Haleth's Avatar
Featured
Join Date: Sep 2008
Posts: 1,173
Change '32' to 'BUFF_ACTUAL_DISPLAY'.
  Reply With Quote
12-29-10, 02:21 PM   #3
Sniffles
A Black Drake
 
Sniffles's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2010
Posts: 86
Thank you very much Haleth

But now I have an another problem. My Buffs/Debuffs are hidden if it is only 1 Buff/Debuff.

Here the code:


Code:
local _G = _G

local function buffstyle()
	for i = 1, BUFF_ACTUAL_DISPLAY do
		_G["BuffButton"..i]:SetHeight(sniffles.btsize)
		_G["BuffButton"..i]:SetWidth(sniffles.btsize)
		CreateBorder(_G["BuffButton"..i], 12, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
		
		_G["BuffButton"..i.."Count"]:SetFont(sniffles.font, sniffles.fsize, sniffles.ftags)
		_G["BuffButton"..i.."Duration"]:SetFont(sniffles.font, sniffles.fsize, sniffles.ftags)
		_G["BuffButton"..i.."Duration"]:SetPoint(sniffles.durpoint[1], _G["BuffButton"..i], sniffles.durpoint[2], sniffles.durpoint[3])
		if _G["BuffButton"..i.."Border"] then _G["BuffButton"..i.."Border"]:Hide() end
	
		_G["BuffButton1"]:ClearAllPoints()
		_G["BuffButton1"]:SetPoint(sniffles.buffspoint[1], sniffles.buffspoint[2], sniffles.buffspoint[3], sniffles.buffspoint[4])
		
		_G["BuffButton"..i]:ClearAllPoints()
		_G["BuffButton"..i]:SetPoint("LEFT", _G["BuffButton"..i-1], (sniffles.space-sniffles.btsize), 0)
	end
	
	for a = 1, 3 do
		_G["TempEnchant"..a]:SetWidth(sniffles.Wbtsize)
		_G["TempEnchant"..a]:SetHeight(sniffles.Wbtsize)
		
		_G["TempEnchant"..a.."Count"]:SetFont(sniffles.font, sniffles.fsize, sniffles.ftags)
		_G["TempEnchant"..a.."Duration"]:SetFont(sniffles.font, sniffles.fsize, sniffles.ftags)
		_G["TempEnchant"..a.."Duration"]:SetPoint(sniffles.Wdurpoint[1], _G["TempEnchant"..a], sniffles.Wdurpoint[2], sniffles.Wdurpoint[3])
		
		CreateBorder(_G["TempEnchant"..a], 12, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
		ColorBorder(_G["TempEnchant"..a], 153/255, 50/255, 204/255)
		
		if _G["TempEnchant"..a.."Border"] then _G["TempEnchant"..a.."Border"]:Hide() end
		
		_G["TempEnchant1"]:ClearAllPoints()
		_G["TempEnchant1"]:SetPoint(sniffles.Wbuffspoint[1], sniffles.Wbuffspoint[2], sniffles.Wbuffspoint[3], sniffles.Wbuffspoint[4])
		
		_G["TempEnchant"..a]:ClearAllPoints()
		_G["TempEnchant"..a]:SetPoint("LEFT", _G["TempEnchant"..a-1], (sniffles.space-sniffles.Wbtsize), 0)
	end
	
	for k = 1, DEBUFF_ACTUAL_DISPLAY do
		_G["DebuffButton"..k]:SetWidth(sniffles.Dbtsize)
		_G["DebuffButton"..k]:SetHeight(sniffles.Dbtsize)
		
		CreateBorder(_G["DebuffButton"..k], 12, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
		ColorBorder(_G["DebuffButton"..k], 1, 0, 0)
		
		_G["DebuffButton"..k.."Count"]:SetFont(sniffles.font, sniffles.fsize, sniffles.ftags)
		_G["DebuffButton"..k.."Duration"]:SetFont(sniffles.font, sniffles.fsize, sniffles.ftags)
		_G["DebuffButton"..k.."Duration"]:SetPoint(sniffles.Ddurpoint[1], _G["DebuffButton"..k], sniffles.Ddurpoint[2], sniffles.Ddurpoint[3])
		if _G["DebuffButton"..k.."Border"] then _G["DebuffButton"..k.."Border"]:Hide() end
		
		_G["DebuffButton1"]:ClearAllPoints()
		_G["DebuffButton1"]:SetPoint(sniffles.Dbuffspoint[1], sniffles.Dbuffspoint[2], sniffles.Dbuffspoint[3], sniffles.Dbuffspoint[4])
		
		_G["DebuffButton"..k]:ClearAllPoints()
		_G["DebuffButton"..k]:SetPoint("LEFT", _G["DebuffButton"..k-1], (sniffles.space-sniffles.Dbtsize), 0)
	end
end

hooksecurefunc("AuraButton_Update", buffstyle)
SetCVar("consolidateBuffs", 0)
InterfaceOptionsBuffsPanelConsolidateBuffs:Hide()
  Reply With Quote
12-29-10, 03:31 PM   #4
Haleth
This Space For Rent
 
Haleth's Avatar
Featured
Join Date: Sep 2008
Posts: 1,173
That's because your positioning is wrong. You're setting BuffButton1 to a certain point then setting BuffButton[i], which includes 1, to an other point.

Code:
		BuffButton1:ClearAllPoints()
		BuffButton1:SetPoint(sniffles.buffspoint[1], sniffles.buffspoint[2], sniffles.buffspoint[3], sniffles.buffspoint[4])
		
	if i ~= 1 then
		_G["BuffButton"..i]:ClearAllPoints()
		_G["BuffButton"..i]:SetPoint("LEFT", _G["BuffButton"..i-1], (sniffles.space-sniffles.btsize), 0)
	end
  Reply With Quote
12-29-10, 03:38 PM   #5
Sniffles
A Black Drake
 
Sniffles's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2010
Posts: 86
Originally Posted by Haleth View Post
That's because your positioning is wrong. You're setting BuffButton1 to a certain point then setting BuffButton[i], which includes 1, to an other point.

Code:
		BuffButton1:ClearAllPoints()
		BuffButton1:SetPoint(sniffles.buffspoint[1], sniffles.buffspoint[2], sniffles.buffspoint[3], sniffles.buffspoint[4])
		
	if i ~= 1 then
		_G["BuffButton"..i]:ClearAllPoints()
		_G["BuffButton"..i]:SetPoint("LEFT", _G["BuffButton"..i-1], (sniffles.space-sniffles.btsize), 0)
	end
It works

Thank you very much!! You are the best
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Buff Frames are skinned but i get .LUA Errors


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