how to fix this? loop?

I need help!

i use the following maxscript to output my variable either when transform or animate:

a=$cylinder01
b=$cylinder02
c=$cylinder03
d=$cylinder04

fs= createfile "C:\\Users\\User\\Desktop\\rotation angles1.txt"
when transform a changes handleAt:#redrawViews do (in coordsys parent format "rotation-y cylinder 01 = %\n" a.rotation.y_rotation to: fs )

fn time_cb = in coordsys parent format "rotation-y cylinder 01 = %\n" a.rotation.y_rotation to: fs
fn tcb = time_cb()
registerTimeCallback tcb

fs1= createfile "C:\\Users\\User\\Desktop\\rotation angles2.txt"
when transform b changes handleAt:#redrawViews do (in coordsys parent format "rotation-z cylinder 02 = %\n" b.rotation.z_rotation to: fs1 )

fn time_cb = in coordsys parent format "rotation-z cylinder 02 = %\n" b.rotation.z_rotation to: fs1
fn tcb = time_cb()
registerTimeCallback tcb

fs2= createfile "C:\\Users\\User\\Desktop\\rotation angles3.txt"
when transform c changes handleAt:#redrawViews do (in coordsys parent format "rotation-z cylinder 03 = %\n" c.rotation.z_rotation to: fs2 )

fn time_cb = in coordsys parent format "rotation-z cylinder 03 = %\n" c.rotation.z_rotation to: fs2
fn tcb = time_cb()
registerTimeCallback tcb

fs3= createfile "C:\\Users\\User\\Desktop\\rotation angles4.txt"
when transform d changes handleAt:#redrawViews do (in coordsys world format "rotation-z cylinder 04 = %\n" d.rotation.z_rotation to: fs3 )

fn time_cb = in coordsys parent format "rotation-z cylinder 04 = %\n" d.rotation.z_rotation to: fs3
fn tcb = time_cb()
registerTimeCallback tcb

i'm sure the script worked when it is only 1 cylinder,
But now the problem is that when i use the script above, i can only get the last files outputed, the other 3 earlier's text files is blank!

What should i do? is it i should make a loop or something else?
Can someone give example on how to fix this?

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Anubis's picture

Hi Wing, you again start a

Hi Wing,
you again start a new thread ... I hope my reply on the previous to helps you: http://www.scriptspot.com/forums/3ds-max/general-scripting/how-to-output...

my recent MAXScripts RSS (archive here)

wingwingwing's picture

Ya, it's very helpful!

Ya, it's very helpful!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.