WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   XML custom coloring (https://www.wowinterface.com/forums/showthread.php?t=37024)

barbol12 11-25-10 02:04 AM

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
Quote:

<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...
Quote:

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?

Xubera 11-25-10 04:47 AM

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

barbol12 11-25-10 09:35 AM

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
Quote:

<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)
Quote:

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


All times are GMT -6. The time now is 02:26 AM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI