WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Lua - coloring certain text in Pitbull (https://www.wowinterface.com/forums/showthread.php?t=43971)

robertito54321 08-26-12 01:09 PM

Lua - coloring certain text in Pitbull
 
Hi all,

As a newbie with Lua I hope some of you guys can help me.
I would like to color my "level" text to white, but I cant find how to do it.

The code looks like this; 85 Warrior Tauren

This is the code (standard code from Pitbull);

local dr,dg,db = ClassColor(unit)
local form = DruidForm(unit)
local classification = Classification(unit)
if UnitIsPlayer(unit) or (not UnitIsFriend(unit,"player") and not IsPet(unit)) then
local cr,cg,cb = ClassColor(unit)
if form then
return "%s%s|cff%02x%02x%02x%s|r |cff%02x%02x%02x%s|r (%s) %s",classification or '',classification and ' ' or '',dr,dg,db,Level(unit),cr,cg,cb,Class(unit),form,SmartRace(unit) or ''
else
return "%s%s|cff%02x%02x%02x%s|r |cff%02x%02x%02x%s|r %s",classification or '',classification and ' ' or '',dr,dg,db,Level(unit),cr,cg,cb,Class(unit),SmartRace(unit) or ''
end
else
if form then
return "%s%s|cff%02x%02x%02x%s|r (%s) %s",classification or '',classification and ' ' or '',dr,dg,db,Level(unit),form,SmartRace(unit) or ''
else
return "%s%s|cff%02x%02x%02x%s|r %s",classification or '',classification and ' ' or '',dr,dg,db,Level(unit),SmartRace(unit) or ''
end
end

Lombra 08-28-12 04:27 AM

Try this:
Code:

local form = DruidForm(unit)
local classification = Classification(unit)
if UnitIsPlayer(unit) or (not UnitIsFriend(unit,"player") and not IsPet(unit)) then
        local cr,cg,cb = ClassColor(unit)
        if form then
                return "%s%s%s |cff%02x%02x%02x%s|r (%s) %s",classification or '',classification and ' ' or '',Level(unit),cr,cg,cb,Class(unit),form,SmartRace(unit) or ''
        else
                return "%s%s%s |cff%02x%02x%02x%s|r %s",classification or '',classification and ' ' or '',Level(unit),cr,cg,cb,Class(unit),SmartRace(unit) or ''
        end
else
        if form then
                return "%s%s%s (%s) %s",classification or '',classification and ' ' or '',Level(unit),form,SmartRace(unit) or ''
        else
                return "%s%s%s %s",classification or '',classification and ' ' or '',Level(unit),SmartRace(unit) or ''
        end
end



All times are GMT -6. The time now is 04:19 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI