Quantcast WoWInterface - View Single Post - need help with some LUA-Texts
View Single Post
10-04-19, 11:27 AM   #6
Janede
A Kobold Labourer
 
Janede's Avatar
Join Date: Oct 2019
Posts: 1
1)
Code:
local s = Status(unit)
if s then
  return s
end
local cur,max=HP(unit),MaxHP(unit);
if cur == max then
 Alpha(0)
end
local r,g,b=HPColor(cur,max);
  return "|cff%02x%02x%02x%.0f%%|r" or "",r,g,b,100*cur/max;
The gradient is basically from SDPhantom's second post, except that HPMax has to be called MaxHP.

2)
Code:
local s = Status(unit)
if s then
  return s
end
return "|cff00ff00%s|r|||cff006400%s",HP(unit),MaxHP(unit)
3)
Code:
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|r | |cff%02x%02x%02x%s",r,g,b,Short(Power(unit),true),r,g,b,Short(max,true)
end
There you go
  Reply With Quote