Thread Tools Display Modes
11-25-10, 02:04 AM   #1
barbol12
A Cyclonian
 
barbol12's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2010
Posts: 42
XML custom coloring

ok guys i have my frame all made.. and set. but i cant figure out how to custom color it, not just r,g,b,a but custom char colors(based on char your playing)
heres my stuff......

XML frame
<Frame name="chat" frameStrata="BACKGROUND" parent="UIParent" visible="true">
<Size>
<AbsDimension x="363" y="147" />
</Size>
<Backdrop bgFile="Interface\Addons\textures\panels.tga"
edgeFile="Interface\Addons\textures\Stripped.tga" tile="false">
<EdgeSize>
<AbsValue val="12"/>
</EdgeSize>
<TileSize>
<AbsValue val="100"/>
</TileSize>
<BackgroundInsets>
<AbsInset left="1" right="1" top="1" bottom="1"/>
</BackgroundInsets>
</Backdrop>
<Anchors>
<Anchor point="LEFT" relativePoint="BOTTOMLEFT">
<Offset x="3" y="103" />
</Anchor>
</Anchors>
</Frame>
heres a custom color table i made...
function setChat()
local _, class = UnitClass("player")

if class == "WARRIOR" then
chat:SetVertexColor(.5, 0.45, 0.3, 1)
chat:SetBackdropBorderColor(.78, 0.61, 0.43, 1)
elseif class == "PRIEST" then
chat:SetVertexColor(.6, .6, .6, 1)
chat:SetBackdropBorderColor(.1, 1, 1, 1)
elseif class == "DRUID" then
chat:SetVertexColor = (.6, .3, 0, 1)
chat:SetBackdropBorderColor(1, .49, 0.4, 1)
elseif class == "HUNTER" then
chat:SetVertexColor(0.5, .6, 0.3, 1)
chat:SetBackdropBorderColor(0.67, .83, 0.45, 1)
elseif class == "MAGE" then
chat:SetVertexColor(0.3, 0.5, 0.6, 1)
chat:SetBackdropBorderColor(0.41, 0.8, 0.94, 1)
elseif class == "PALADIN" then
chat:SetVertexColor(0.7, 0.4, 0.5, 1)
chat:SetBackdropBorderColor(0.96, 0.55, 0.73, 1)
elseif class == "SHAMAN" then
chat:SetVertexColor(0.1, 0.3, .65, 1)
chat:SetBackdropBorderColor(0, 0.44, .87, 1)
elseif class == "WARLOCK" then
chat:SetVertexColor(0.35, 0.3, .45, 1)
chat:SetBackdropBorderColor(0.58, 0.51, .79, 1)
elseif class == "ROGUE" then
chat:SetVertexColor(.7, .7, 0.3, 1)
chat:SetBackdropBorderColor(1.0, .96, 0.41, 1)
elseif class == "DEATHKNIGHT" then
chat:SetVertexColor(.5, .05, .15, 1)
chat:SetBackdropBorderColor(.77, .12, .23, 1)
end
end
i want to know how i can get those custom colors into my backdrop and backdrop border... also to have it set to be (OnLoad) or something like that... can someone help me finish this thing?
  Reply With Quote
11-25-10, 04:47 AM   #2
Xubera
A Cobalt Mageweaver
 
Xubera's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 207
change the

chat:SetVertexColor()

to

chat:SetBackdropColor()

edit::

For the onload, just wrap your .lua bit in a function like

Code:
function chat_OnLoad()
  --lua stuff goes here
end
and in your XML, add <Scripts> tag

Code:
<Frame name="chat">
  ...
  <Scripts>
    <OnLoad function="chat_OnLoad" />
  </Scripts>
  ...
</Frame>
and make sure your .toc loads the XML before the lua
__________________
Chat Consolidate is the solution to any out of control trade chat. Ignore lines, throttle chat, consolidate posts!Follow the link to find out how!

▲ ▲ WoWInterface wont let me triforce >.>

Last edited by Xubera : 11-25-10 at 04:49 AM.
  Reply With Quote
11-25-10, 09:35 AM   #3
barbol12
A Cyclonian
 
barbol12's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2010
Posts: 42
ive tried all that.. but it doesnt seem to work.. i still end up with a white background (the color of the bgfile). ive made all the changes that u said.. heres my new coding...

frame itself... and with the scripting
<Frame name="chat" frameStrata="BACKGROUND" parent="UIParent" visible="true">
<Size>
<AbsDimension x="363" y="147" />
</Size>
<Backdrop bgFile="Interface\Addons\textures\panels.tga"
edgeFile="Interface\Addons\textures\Stripped.tga" tile="false">
<EdgeSize>
<AbsValue val="12"/>
</EdgeSize>
<TileSize>
<AbsValue val="100"/>
</TileSize>
<BackgroundInsets>
<AbsInset left="1" right="1" top="1" bottom="1"/>
</BackgroundInsets>
</Backdrop>
<Scripts>
<OnLoad function="chat_OnLoad" />
</Scripts>
<Anchors>
<Anchor point="LEFT" relativePoint="BOTTOMLEFT">
<Offset x="3" y="103" />
</Anchor>
</Anchors>
</Frame>
Lua coding(with ur changes)
function chat_OnLoad()
local _, class = UnitClass("player")

if class == "WARRIOR" then
chat:SetBackdropColor(.5, 0.45, 0.3, 1)
chat:SetBackdropBorderColor(.78, 0.61, 0.43, 1)
elseif class == "PRIEST" then
chat:SetBackdropColor(.6, .6, .6, 1)
chat:SetBackdropBorderColor(.1, 1, 1, 1)
elseif class == "DRUID" then
chat:SetBackdropColor = (.6, .3, 0, 1)
chat:SetBackdropBorderColor(1, .49, 0.4, 1)
elseif class == "HUNTER" then
chat:SetBackdropColor(0.5, .6, 0.3, 1)
chat:SetBackdropBorderColor(0.67, .83, 0.45, 1)
elseif class == "MAGE" then
chat:SetBackdropColor(0.3, 0.5, 0.6, 1)
chat:SetBackdropBorderColor(0.41, 0.8, 0.94, 1)
elseif class == "PALADIN" then
chat:SetBackdropColor(0.7, 0.4, 0.5, 1)
chat:SetBackdropBorderColor(0.96, 0.55, 0.73, 1)
elseif class == "SHAMAN" then
chat:SetBackdropColor(0.1, 0.3, .65, 1)
chat:SetBackdropBorderColor(0, 0.44, .87, 1)
elseif class == "WARLOCK" then
chat:SetBackdropColor (0.35, 0.3, .45, 1)
chat:SetBackdropBorderColor(0.58, 0.51, .79, 1)
elseif class == "ROGUE" then
chat:SetBackdropColor(.7, .7, 0.3, 1)
chat:SetBackdropBorderColor(1.0, .96, 0.41, 1)
elseif class == "DEATHKNIGHT" then
chat:SetBackdropColor(.5, .05, .15, 1)
chat:SetBackdropBorderColor(.77, .12, .23, 1)
end
end
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » XML custom coloring


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