Jump to content

Recommended Posts

How do I make a point in the number?
Example: 100,000 TP
 

SU3Uaab.png

		self.textHP.SetText("TP: " + str(int(float(hpPercentage)/100.00*float(self.hpMobsList[chr.GetRace()]))) + "/" + str(self.hpMobsList[chr.GetRace()]))
		self.hpGauge.SetPercentage(hpPercentage, 100)

 

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • Forum Moderator

You can use:

  • localeInfo.NumberToMoneyString
def NumberToMoneyString(n) :
	if n <= 0 :
		return "0 %s" % (MONETARY_UNIT0)
	return "%s %s" % ('.'.join([ i-3<0 and str(n)[:i] or str(n)[i-3:i] for i in range(len(str(n))%3, len(str(n))+1, 3) if i ]), MONETARY_UNIT0)

The current  function return a value + MONETARY_UNIT0, you can split it and don't need any new function.

print localeInfo.NumberToMoneyString(2147483647)
#Result: 2.147.483.647 Yang

print localeInfo.NumberToMoneyString(2147483647).split(' ')[0]
#Result: 2.147.483.647

I don't know what structure you have in hpMobsList, but here's a example.

maxHP = self.hpMobsList[chr.GetRace()]
minHP = int(float(hpPercentage) / 100.00 * float(maxHP))
self.textHP.SetText("TP: {:s}/{:s}".format(localeInfo.NumberToMoneyString(minHP).split(' ')[0], localeInfo.NumberToMoneyString(int(maxHP)).split(' ')[0]))
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.