#Specific text coloring
6 messages · Page 1 of 1 (latest)
To update the issue with raw code, maybe some1 is gonna get attracted:
function(_, _, _, _, name)
local _, class = UnitClass(name)
local color
local currentHP = UnitHealth("player")
local percent = (UnitHealth("player")/UnitHealthMax("player"))*100
local percentFormatted = ("%.0f"):format(percent)
local power = UnitPower("player" , powerType);
if class and RAID_CLASS_COLORS[class] then
color = "|c" .. RAID_CLASS_COLORS[class].colorStr
else
color = "|cff4baf4c"
end
return color .. power .. ' | ' .. percentFormatted .. '%' .. ' | ' .. currentHP
end
Lets say something like this would yield almost the result i want.
Only issue is that i dont know how to isolate color to power and not the rest of the text.
And i dont know how to shorten the HP value to 12k instead of raw value.
Aaaand nevermind i figured it out
You should use a power and health trigger to get the information instead @pulsar vapor
function(_, _, _, _, name)
local _, class = UnitClass(name)
local color
local currentHP = AbbreviateLargeNumbers(UnitHealth("player"))
local percent = (UnitHealth("player")/UnitHealthMax("player"))*100
local percentFormatted = ("%.0f"):format(percent)
local power = UnitPower("player" , powerType);
if class and RAID_CLASS_COLORS[class] then
color = "|c" .. RAID_CLASS_COLORS[class].colorStr
else
color = "|cff4baf4c"
end
return color .. power .. '|r | ' .. percentFormatted .. '%' .. ' | ' .. currentHP
end
Did it like this in the end.
Yeah @trail lotus i realized i can combine custom code with built in WA tags, so i will probably end up deleting everything and just return the colored power.
I didnt know |r is the escape string to stop coloring.
