Originally Posted by Nikita S. Doroshenko
Lua Code:
function(unit, cache, textframe) local curhp, maxhp if UnitExists(unit) then curhp = UnitHealth(unit) maxhp = UnitHealthMax(unit) else curhp = UnitHealth("player") maxhp = UnitHealthMax("player") end local perchp = 100 * curhp/maxhp local stamp = curhp.." / "..maxhp.." | ".."%.2f%%" return stamp,perchp end
|
This one works perfect, thank you! I attempted (with no knowledge of lua) to also make it into the format of
60.00% | 300000/500000
but the text would disappear each time. How would I go about switching it around?
Edit:
Lua Code:
function(unit, cache, textframe)
local curhp, maxhp
if UnitExists(unit) then
curhp = UnitHealth(unit)
maxhp = UnitHealthMax(unit)
else
curhp = UnitHealth("player")
maxhp = UnitHealthMax("player")
end
local perchp = 100 * curhp/maxhp
local stamp = "%.2f%%".." | "..curhp.." / "..maxhp
return stamp,perchp
end
Figured it out after messing around a bit! However, I've now noticed that the numbers are not being shortened (I have my STUF options to shorten starting at 1 million).
Instead of showing 1M, its showing 1000000. Any way to fix this?
Ideally I'd like it to show like this -
60.00% | 3.0M / 5.0M
5.00% | 250000 / 5.0M