Notifications
Clear all

[Closed] For Loop with fload expression

Hi all, Im wondering how can I add the variable of a loop to an expression in a float Expression

here is what Im doing. And gives me an error, but I dont know how to assign ā€œiā€ to the expression.

for i = 1 to $splineColumna.modifiers[#Spline_IK_Control].getKnotCount() do
(

CtrlIK=$SplineColumna.modifiers[#Spline_IK_Control].helper_list[i]
CtrlIK.rotation.controller.Y_Rotation.controller = float_list ()
ctrlIKFloatExpression= CtrlIK.rotation.controller.Y_Rotation.controller.Available.controller = Float_Expression()		   
ctrlIKFloatExpression.setExpression "sin (F*5+i)*.2"

)

thanks and sorry for my english

3 Replies
str = "sin (F*5+" + i as string + ")*.2"

thans man

but unfortunatly it`s still giving me an error, I dont know why, I copied the string as you put in

>> MAXScript Rollout Handler Exception:
ā€“ Runtime error: IExprCtrl::SetExpression – Expression parse error: sin (F*5+ <<

try this

for i = 1 to $splineColumna.modifiers[#Spline_IK_Control].getKnotCount() do
(

	CtrlIK=$SplineColumna.modifiers[#Spline_IK_Control].helper_list[i]
	CtrlIK.rotation.controller.Y_Rotation.controller = float_list ()
	ctrlIKFloatExpression= CtrlIK.rotation.controller.Y_Rotation.controller.A  vailable.controller = Float_Expression()	
	str = "sin (F*5+" + i as string + ")*.2"	   
	ctrlIKFloatExpression.setExpression &str

)