Quantcast
WoWInterface - View Single Post - decimal point/full number
View Single Post
03-12-21, 08:54 PM   #1
rulezyx
A Flamescale Wyrmkin
 
rulezyx's Avatar
Join Date: Jan 2020
Posts: 106
decimal point/full number

Hello,

I got a code for my raidframes to show health with one decimal point.

Example:

44100 = 44.1k

When the health is under 1k:

910 = 0.9k

But I want it to display the full number when under a thousand so 910 instead of 0.9k.

Can someone help me with this code:
Code:
hooksecurefunc("CompactUnitFrame_UpdateStatusText",function(self)
if self.optionTable.healthText=="health" and tonumber(self.statusText:GetText() or "") then
local hp = UnitHealth(self.displayedUnit)
local maxhp = UnitHealthMax(self.displayedUnit)
self.statusText:SetText(format("%d%%     %.1fk",hp*100/maxhp,hp/1000))
self.statusText:SetTextColor(0.9,0.9,0.9,1)
if not self.smallStatus then
self.statusText:SetFont("Fonts\\ARIALN.TTF", 14, "THINOUTLINE")
self.smallStatus = false
end
end
end)
  Reply With Quote