Notifications
Clear all

[Closed] padding numbers < 10 in float script controller?

There was a nice tutorial on this link of how to animate text and make it change over time based on distance between 2 objects.
https://www.youtube.com/watch?v=A6V5DE2GKZE
Does anyone know how to pad the numbers so any numbers below 10 a zero is added in front of it.?
The code needs to be added in the expression window to the first line i believe and Iam not sure how it can be done if at all.
the tut is short if you decide watch it
thanks for any help.

2 Replies

See formattedPrint in the maxscript reference.

If you are on a recent version of 3ds Max, you can use the TextPlus object and avoid all this.
But if you want to do it the scripted way, just use

formattedPrint val format:“02d”

to get a 2-padding (01,02,03…09,10,11) or

formattedPrint val format:“04d”

to get a 4-padding