Notifications
Clear all

[Closed] maxscript read data from file and animate error

I’m trying to read comma separated numeric values from a file and animate a sphere in a scene with those values, but I’m getting an error.

here is the error:

#()
<File:c: emp est.txt>
– Error occurred in j loop; filename: C:\Dropbox\3dsMax\max scripts\read-delimited-string08.ms; position: 243; line: 9
– Frame:
– j: 1
– called in anonymous codeblock; filename: C:\Dropbox\3dsMax\max scripts\read-delimited-string08.ms; position: 243; line: 9
– Frame:
– str: “7”
– Unable to convert: “7” to type: Float
OK
OK

This is the code I’m working with:

path_array = #()
in_text = openfile “c:\ emp\ est.txt”
while not eof in_text do
(
str = readDelimitedString in_text “,”
if str != “
” then append path_array str
(
for j=1 to path_array.count do
move $Sphere001 [path_array[j],1,1]
)
)
close in_text

the numbers being read from the file:
7,1,2,3,45,6

Any assistance with why this is happening and how to fix it would be much appreciated.

1 Reply

found the answer using the ‘as float’ when creating the keyframes worked out the issue
this is resolved