ScriptSpot

Forum topic · General Scripting

when changes do

By zambi · 2016-06-28

Description

I'm interested only construction "when changes do". File contains the code base, and three of the end.The first part of the code works well. When I add loop problems begin.(2-3part)
2 part - he does not see the value(i in loop) as local but he see the value as global (3 part)
3 part - performed only cycle end code

"when changes do"- expression works in the cycle? (Give an example of code)
In the code (2-3 part), value can leave a local variable?

Attachments
Comments (2)

`

pixamoon · 2016-07-08

Hi,

Try this one:


str = stringStream ""
	
for i = 1 to 2 do (
	format "when transform Ar_Hpoint[%] changes do (setKnotPoint Ar_Line[%] 1 1 Ar_Hpoint[%].pos ; updateShape Ar_Line[%])\n" i i i i to:str
	format "when transform Ar_Hpoint[%+1] changes do (setKnotPoint Ar_Line[%] 1 2 Ar_Hpoint[%+1].pos ; updateShape Ar_Line[%])\n" i i i i to:str
)
	
execute(str as string)

Full code in attachemnts

Best,
Pixamoon

Attachments

zambi · 2016-07-08

Thank, it's working and this is what I needed.