[Closed] Syntax error at ) expecte while -explanation?
Hi,
got my script running fine until I changed some stuff in UI (using Visual maxscript editor – by going to tools edit roll)
I know it isn’t the best way.
But since then I can’t start the script again.
it comes with error :
“– Error occurred in anonymous codeblock; filename: D:_Script\SIM_orientation_v002.ms; position: 1408; line: 59
– Syntax error: at ), expected while
– In line: )”
here is the script :
createdialog (
rollout unnamedRollout “Quick Align” width:162 height:300
(
radiobuttons rdo8 “RadioButtons” pos:[16,48] width:97 height:30 labels:#(“X”, “Y”, “Z”) default:0 columns:3
editText edtnth “Every Nth Frames” pos:[15,89] width:113 height:18 text:“1”
button applyorient “Button” pos:[35,116] width:92 height:36
button btnnukerot “NukeRotation” pos:[37,168] width:92 height:36on rdo8 changed state do (
if state == 1 do print “X axis”
if state == 2 do print “Y axis”
if state == 3 do print “Z axis”)
on applyorient pressed do (
selorient = $
timeline = animationrange.end.frame as integer
animate on
for i = 0 to timeline by do (
slidertime = 1
slidertime = i
p1 = at time i selorient.pos
p2 = at time (i+1) selorient.posif rdo8.state == 1 do (
x = normalize (p2 – p1)
z0 = [0,0,1]
y = normalize (cross z0 x)
z = normalize (cross x y)
mymatrix = (matrix3 x y z p1) )if rdo8.state == 2 do (
y = normalize (p2 – p1)
z0 = [0,0,1]
x = normalize (cross z0 y)
z = normalize (cross y x)
mymatrix = (matrix3 x y z p1) )if rdo8.state == 3 do (
z = normalize (p2 – p1)
x0 = [1,0,0]
y = normalize (cross x0 z)
x = normalize (cross z y)
mymatrix = (matrix3 x y z p1) )at time (currenttime.frame) in coordsys (transmatrix selorient.pos) selorient.rotation=inverse(mymatrix.rotation)
)
)
))
I believe maxscript is expecting a while. I never quite understood the “while” thing.
Any help would be great.
Thanks.
You left a “BY” in your FOR statement, if you remove it (or add the missing part), it seem to work.
Oh, damn… thank you so much!! :bowdown:
I guess sometimes I m too much looking at it, and I don’t see the mistake.
Again, THANK YOU!