the following code was supplied by Phanx but I was wondering if there is a way to make it do the following.
Full Health = 345K
Full Mana = 160K
Not Full Health = 160K/345K
Not Full Mana = 80K/160K
Code Supplied by Phanx:
Lua Code:
local shorts = {
{ 1e10, 1e9, "%.0fb" }, -- 10b+ as 12b
{ 1e9, 1e9, "%.1fb" }, -- 1b+ as 8.3b
{ 1e7, 1e6, "%.0fm" }, -- 10m+ as 14m
{ 1e6, 1e6, "%.1fm" }, -- 1m+ as 7.4m
{ 1e5, 1e3, "%.0fk" }, -- 100k+ as 840k
{ 1e3, 1e3, "%.1fk" }, -- 1k+ as 2.5k
{ 0, 1, "%d" }, -- < 1k as 974
}
for i = 1, #shorts do
shorts[i][4] = shorts[i][3] .. " (%.0f%%)"
end
hooksecurefunc("TextStatusBar_UpdateTextStringWithValues", function(statusBar, fontString, value, valueMin, valueMax)
if value == 0 then
return fontString:SetText("")
end
local style = GetCVar("statusTextDisplay")
if style == "PERCENT" then
return fontString:SetFormattedText("%.0f%%", value / valueMax * 100)
end
for i = 1, #shorts do
local t = shorts[i]
if value >= t[1] then
if style == "BOTH" then
return fontString:SetFormattedText(t[4], value / t[2], value / valueMax * 100)
else
return fontString:SetFormattedText(t[3], value / t[2])
end
end
end
end)
Thank in advance for any help.
Coke