when changes do

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?

AttachmentSize
script.txt1.84 KB

Comments

Comment viewing options

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

`

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

AttachmentSize
_when_transform_changes_do_001.ms 2.26 KB
zambi's picture

Thank, it's working and this

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

Comment viewing options

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