Notifications
Clear all

[Closed] Outputting values to filename help

Hi all,

I’m just learning to output values to files and I am a little stuck.

Basically I am try to do things which involve creating multiple ouput files.

I am having 2 problems here.

  1. How do I use a variable to add to the name of my output file?

  2. For some reason my for loop seems to have stopped working

In this example I am doing something basic, reading the value of a morph target channel on an object and then ouput that value to a file.

Code below, any help appreciated.

Thanks

x=0	
for x = 1 to 5 do 
(
	out_name = "C:/extest/+'x'+myfile.txt"
	out_file = createfile out_name	
	format "%
" $teapot.morpher[x].value to:out_file
	close out_file
)
2 Replies
for x = 1 to 5 do 
   (
   	out_name = "C:/extest/" + (x as string) + "morpher.txt"
   	out_file = createfile out_name
   	format "%
" $teapot.morpher[x].value to:out_file
   	close out_file
   )

Ahhh! Thats it, thank you!