For now i just start with 1000. Then i d'ont have problems to add 1 each time i need to, keeping the same number of digits.
Working on Windows 10
Creator of Disnosc, providing storyboard, animation and design for 2D realistic pictural animation: https://www.disnosc.fr/ - nathanotano@disnosc.fr
Highly interested in animation workflows, I'm open to scripting new TVP functions for individuals and studios.
Shotnumber = 1
string_addZeros(shot_,Shotnumber,3)
Shotnumber = result
#PRINT Shotnumber
FUNCTION string_addZeros(prefix,digit,length)
LOCAL cur i
length=length*1
digit=digit*1
cur = LEN(digit)
length=length-1
FOR i=cur TO length
prefix=prefix"0"
END
prefix =prefix""digit
result = prefix
RETURN result
END
This prints: "shot_001"
It's not possible to get "001" back without anything in front of the zeros. The prefix is necessary. :/
tv_clipname
clipName = result
string_addZeros('/',clipName,3)
clipName = result
saveDir = projectdir"/"GestionPath""clipName // <---(There's no / in path, because I added it as a prefix)
print saveDir
This works for shot 001, 002, but when I get to '014A' it gets confused. :s
Mads Juul wrote:I think string_addZeros() only works when the string is ending on a digit
I change the function so it can take a string with a digit in the middle and add zeros to the digit
for instance
string_addZeros("/","mads1juul",5)
would give this result
"/mads00001juul"