so_many_mars/scripts/string_fix/string_fix.gml

17 lines
534 B
Plaintext
Raw Permalink Normal View History

2022-02-21 23:45:19 +00:00
// Script assets have changed for v2.3.0 see
// https://help.yoyogames.com/hc/en-us/articles/360005277377 for more information
function string_fix(){
///string_fix(number,places)
//Returns a zero-padded (or cut) string of the number so that it gets desired number of places.
var del;
argument0 = string(floor(argument0))
del = string_length(argument0) - argument1
if(del>0){
return string_delete(argument0,1,del)
}
else if(del<0){
return string_repeat("0",-del) + argument0
} else {
return argument0
}
}