![]() | ![]() | |
| Pad a number with leading zeros | ||
![]() | ![]() | |
This is a script I use for scores. Scores always look better if padded out with 0s, it helps your game to look like a proper arcade game. To use, simply pass the score to this script as a string, and you will be returned a string containing your score padded by the requested number of zeros.
![]() | ![]() | |
var strIN; var strST; /* argument 0 = score (as a string) argument 1 = total width required */ strIN = string(argument0); if argument1 > string_length(strIN) { strST = string_repeat("0", argument1 - string_length(strIN)); } else { strST = ""; } strST += strIN; return strST; | ||
![]() | ![]() | |
|
|









Facebook
Delicious
Digg







StumbleUpon
Mixx
reddit