Thread Tools Display Modes
05-31-10, 01:12 PM   #1
XoL
A Defias Bandit
 
XoL's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 3
Need help for a Lua Text Code

Hey Guys,

im searching for a lua text help.

What i want to do is a text With current hp and percent hp IF ! percent hp is lower than 100.

It should look like this in the unit frame :

24.k ( If 100% )
23.0k | 90 % (if 90%)

can anybody help me ?
  Reply With Quote
05-31-10, 03:04 PM   #2
NitraMo
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 24
This code should produce the desired output:

(math.floor(UnitHealth("player")/100+0.5)/10).."k"..(UnitHealthMax("player")>UnitHealth("player") and " | "..(math.floor(UnitHealth("player")/UnitHealthMax("player")*100+0.5)).."%" or "")


If you want decimals on the percentage, see the green text. Add one 0 on each of those two numbers for each extra decimal you want, this one got one decimal

(math.floor(UnitHealth("player")/100+0.5)/10).."k"..(UnitHealthMax("player")>UnitHealth("player") and " | "..(math.floor(UnitHealth("player")/UnitHealthMax("player")*1000+0.5)/10).."%" or "")
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Need help for a Lua Text Code


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