class coloring text help
Code:
Text:SetText(floor(GetFramerate()).." |cfffffffffps || |r"..select(3, GetNetStats()).." |cffffffffms|r") |
This page may help you http://www.wowwiki.com/Class_colors. Looks like there is a global table containing all the colors.
|
i know how to make borders and things that use class colored::
blah:Set...Color(r,g,b,a) but not text or specific parts of the text :( |
what you are looking for is string.format
SetText(string.format("|cffffffffFPS|r %d || |cffffffffMS|r %d", fpsfunc, msfunc)) http://lua-users.org/wiki/StringLibraryTutorial |
Quote:
I believe what you're looking for is the proper way to use the " |c " and the " |r " right? I don't know the correct terminology but here goes. Here's an example(For direct string usage): "|cff00ff00TEXT|r" So what is happening here is we have just like in HTML or BBC you have beginning and ending tags to show where the color is placed. The first "ff" I BELIEVE is intensity? I have no idea tbh, and the next 6 numbers/letters are the hex equivalent of the color you're wanting. Now how do we make it the color of your character? Since there isn't a hex color relationship from the RAID_CLASS_COLORS * from my crap knowledge * you can set a table to represent each class with the color corresponding: Code:
local classColor = { To ensure the name of our class is exact to the table, we want to avoid using the localized name of the class: Code:
local _, pClass = UnitClass("player") Now for the text: Code:
string = "|cff"..classColor[pClass].."TEXT|r" So looking at your code here: Code:
Text:SetText(floor(GetFramerate()).." |cff"..classColor[pClass].."fps || |r"..select(3, GetNetStats()).." |cff"..classColor[pClass].."ms|r") ...but I think I got what you were looking for? |
thx alot !! that works perfectly. and thank you very much for the explanation really appreciate it.
|
Well it looks like you have the right format but maybe something not quite right if it isn't working. Also though there is http://www.wowwiki.com/API_FontInstance_SetTextColor which you can use to color a full fontinstance object.
For text portions though this is what I use in my TOCs. |cffeda55fYourTextGoesHere|r It might be that the || in between the |c and |r in your code may be messing it up somewhat. D'oh, beaten by Katt rofl. |
Spoon feeding
Code:
SetText(string.format("%d |cff%02x%02x%02xfps|r ||| %d |cff%02x%02x%02xms|r", floor(GetFramerate()), RAID_CLASS_COLORS[select(2, UnitClass("player"))].r*255, RAID_CLASS_COLORS[select(2, UnitClass("player"))].g*255, RAID_CLASS_COLORS[select(2, UnitClass("player"))].b*255, select(3, GetNetStats()), RAID_CLASS_COLORS[select(2, UnitClass("player"))].r*255, RAID_CLASS_COLORS[select(2, UnitClass("player"))].g*255, RAID_CLASS_COLORS[select(2, UnitClass("player"))].b*255)) |
Quote:
|
Quote:
well its not that much now is it? Code:
local _, player = UnitClass("player") |
Quote:
|
thx for the replys guys.. please dont delte ur posts very helpful for an overall understand :D
|
any reason why using the string.format that Bruners gave me isn't updating. When I first log on lets say I get 43 fps - 200ms. that will never change unless I /reloadui but then again it picks up the first readings and not change
|
Quote:
There's also a new method that can be used, fontstring:SetFormattedText(formatstring,arg1,...) |
Quote:
|
All times are GMT -6. The time now is 05:23 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI