Trying to create a text object again, which I've never really understood. Basically, I want to be HP% (without the % sign), then a Trunc'd HP.
80 | 120.5k
Something like that. Sooo, here's what I stitched together, copied some code from somewhere else and tried to throw it into this but it didn't seem to want to work (expectedly!) xD
lua Code:
RDX.RegisterStatusTextType({
name = "polhptxt";
title = VFLI.i18n("(Polished) HP% | Current HP");
OnExpose = hpPrereq;
OnApply = hpHint;
GeneratePaintCode = function(objname) return [[
function trunc(value)
if value >= 1e7 then
return format("%.1fm", value / 1e6)
elseif value >= 1e6 then
return format("%.2fm", value / 1e6)
elseif value >= 1e5 then
return format("%.0fk", value / 1e3)
elseif value >= 1e3 then
return format("%.1fk", value / 1e3)
else
return value
end
end
RDX.SetStatusText(]] .. objname .. [[, unit:FracHealth(), _white, _red);
if not unit:IsIncapacitated() then
if UnitIsDead(uid) then
]] .. objname .. [[:SetText("Dead");
elseif UnitIsGhost(uid) then
]] .. objname .. [[:SetText("Ghost");
elseif not UnitIsConnected(uid) then
]] .. objname .. [[:SetText("LinkDead");
elseif UnitIsPlayer(uid) then
]] .. objname .. [[:SetFormattedText("%0.0f% | %d, unit:FracHealth()*100, trunc(unit:Health()));
else
]] .. objname .. [[:SetFormattedText("%0.0f%% | %s", unit:FracHealth()*100, trunc(VFL.Kay(unit:Health())));
end
else
]] .. objname .. [[:SetText("");
end
]]; end;
});