View Single Post
12-10-11, 09:29 PM   #1
Wimpface
A Molten Giant
 
Wimpface's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 648
Need help with a text display for Talents

I want this to show my talent spec (i.e 'Elemental', 'Holy' etc) but it won't! So I figured I ****ed up somewhere. This leads me here!

Code:
--[[
	Based on LynStats
--]]

local addon = CreateFrame("Frame", nil, UIParent)

-- CONFIG --
-- frame
local frame_anchor = "BOTTOM"
local frame_x = 0
local frame_y = 5
-- text
local text_anchor = "BOTTOM"
local font = "Fonts\\ARIALN.TTF"
local size = 12
local classcolors = true -- true or false

if classcolors == true then
	color = CUSTOM_CLASS_COLORS[select(2, UnitClass("player"))]
else
	color = { r=0, g=0.8, b=1 } -- own textcolor
end

-- END OF CONFIG --

local text = addon:CreateFontString(nil, 'OVERLAY')
for i = 1, GetNumTalentTabs() do
	local _, talent = GetTalentTabInfo(i)
end

function addon:event()
	if (event == 'PLAYER_ENTERING_WORLD') then
		text:SetText(talent)
	elseif (event == 'ACTIVE_TALENT_GROUP_CHANGED') then
		text:SetText(talent)
	end
end

text:SetPoint(frame_anchor, frame_x, frame_y)
text:SetFont(font, size)
text:SetTextColor(color.r, color.g, color.b)
See anything wrong? I've gone over it a few times and I see nothing wrong at all.
__________________
All I see is strobe lights blinding me in my hindsight.

Last edited by Wimpface : 12-10-11 at 09:45 PM.
  Reply With Quote