Thread Tools Display Modes
01-24-12, 12:31 AM   #1
unlimit
Lookin' Good
 
unlimit's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 484
xD How do I do this!

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:
  1. RDX.RegisterStatusTextType({
  2.     name = "polhptxt";
  3.     title = VFLI.i18n("(Polished) HP% | Current HP");
  4.     OnExpose = hpPrereq;
  5.     OnApply = hpHint;
  6.     GeneratePaintCode = function(objname) return [[
  7.     function trunc(value)
  8.         if value >= 1e7 then
  9.             return format("%.1fm", value / 1e6)
  10.         elseif value >= 1e6 then
  11.             return format("%.2fm", value / 1e6)
  12.         elseif value >= 1e5 then
  13.             return format("%.0fk", value / 1e3)
  14.         elseif value >= 1e3 then
  15.             return format("%.1fk", value / 1e3)
  16.         else
  17.             return value
  18.         end
  19.     end
  20.  
  21.     RDX.SetStatusText(]] .. objname .. [[, unit:FracHealth(), _white, _red);
  22.     if not unit:IsIncapacitated() then
  23.         if UnitIsDead(uid) then
  24.             ]] .. objname .. [[:SetText("Dead");
  25.         elseif UnitIsGhost(uid) then
  26.             ]] .. objname .. [[:SetText("Ghost");
  27.         elseif not UnitIsConnected(uid) then
  28.             ]] .. objname .. [[:SetText("LinkDead");
  29.         elseif UnitIsPlayer(uid) then
  30.             ]] .. objname .. [[:SetFormattedText("%0.0f% | %d, unit:FracHealth()*100, trunc(unit:Health()));
  31.         else
  32.             ]] .. objname .. [[:SetFormattedText("%0.0f%% | %s", unit:FracHealth()*100, trunc(VFL.Kay(unit:Health())));
  33.         end
  34.     else
  35.         ]] .. objname .. [[:SetText("");
  36.     end
  37. ]]; end;
  38. });
__________________


kúdan: im playing pantheon
JRCapablanca: no youre not
** Pantheon has been Banned. **
  Reply With Quote
01-24-12, 02:08 PM   #2
unlimit
Lookin' Good
 
unlimit's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 484
So I just discovered what VFL.Kay does. xD
__________________


kúdan: im playing pantheon
JRCapablanca: no youre not
** Pantheon has been Banned. **
  Reply With Quote

WoWInterface » Featured Projects » OpenRDX » OpenRDX Community » OpenRDX: Community Chat » xD How do I do this!


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off