formating numbers... IE 02 09:12 ...

I lost the posting where this was brought up...
Someone wanted to display their game time with leading zeros...
Like 09:45... or 12:05... not like 9:45 or 12:5
Here is the simple answer...
player.hr = right("00"+player.time, 2)
player.mm = right("00"+player.time, 2)
then the time would be:
"the current time is {player.hr}:{player.mm}

or for 3 digits like a heading.. 045...
player.hd = right("000"+player.heading, 3)


awesome code, very creative and simple/concise design! well done! this will be of great use for people!


This is the "old Basic" way of doing this before the Basic programmers created the Format command...
(and thanks!)


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums