This site makes extensive use of JavaScript.
Please enable JavaScript in your browser.
Classic Theme
Thottbot Theme
Pitbull Lua text, problem with text coloring
Post Reply
Return to board index
Post by
Zeldrin
I basically need to have my power text colored depending on which power type it is.
With the very basic lua understanding i have, i would assume it to be something like:
local r,g,b = PowerColor(power_type)
local max = MaxPower(unit)
if max > 0 then
return "|cff%02x%02x%02x%s | %s",r,g,b,Short(Power(unit),true),Short(max,true)
end But all i've managed to do with this is making the power text grey :/
Any help on what i'm doing wrong here is greatly appreciated :3
Edit: have a second coloring issue ._.
Outline()
local dr,dg,db = DifficultyColor(unit)
local r,g,b = ClassColor(unit)
local form = DruidForm(unit)
if form then
return '|cff%02x%02x%02x%s |cff%02x%02x%02x%s|r (%s) %s%s%s',dr,dg,db,Level(unit),r,g,b,Name(unit),form,Angle(AFK(unit) or DND(unit))
else
return '|cff%02x%02x%02x%s |cff%02x%02x%02x%s|r %s%s%s',dr,dg,db,Level(unit),r,g,b,Name(unit),Angle(AFK(unit) or DND(unit))
end This code colors the unit name depending on the class, it also does so for npcs, is it possibly to only have it color the name for players, leaving npcs with a white text?
Post by
213828
This post was from a user who has deleted their account.
Post by
Wanderingfox
%02x should be converting them to 2 digit hex strings already. PowerColor(powerType) already returns R,G,B in decimal (0-255).
Post by
Zeldrin
Found a solution for my first problem:
local _,power_name = UnitPowerType(unit)
local r,g,b = PowerColor(power_name)
local max = MaxPower(unit)
if max > 0 then
return "|cff%02x%02x%02x%s | %s",r,g,b,Short(Power(unit),true),Short(max,true)
end Now i just need to figure other one out :p
Post Reply
You are not logged in. Please
log in
to post a reply or
register
if you don't already have an account.