General
"For" loop problem
Started by hodok on .
Sign in or create an account to join the conversation.
I trying to make something like this loop, I removed many parts, but I left that is not working as I expected. And what I expected is that Monitor and Monitor3 will show value of slider with number corresponding to loop iteration number(i), but it shows only 0. How do I make it working properly?
loop.jzml
decl i, size=sizeof(MultiSlider.x);
for (i=1;i<size;i++);
{
p3 = MultiSlider.x;
q3 = MultiSlider.x[0];
if (i=1);
{
Monitor.value = p3;
Monitor2.value = q3;
}
if (i=2);
{
Monitor3.value = p3;
Monitor4.value = q3;
}
}
loop.jzml
BTW it works if you reduce p3 and q3, but I can't do without them.
A few minor issues . .
Placement of ';' . . .
'=' is assignment '==' is comparison
decl i, size=sizeof(MultiSlider.x);
for (i=1;i<size;i++)
{
p3 = MultiSlider.x;
q3 = MultiSlider.x[0];
if (i==1)
{
Monitor.value = p3;
Monitor2.value = q3;
}
if (i==2)
{
Monitor3.value = p3;
Monitor4.value = q3;
}
}
And it could all be achieved with a loop anyway just straight assigns - not sure why you have chosen the looping . . .
Placement of ';' . . .
'=' is assignment '==' is comparison
decl i, size=sizeof(MultiSlider.x);
for (i=1;i<size;i++)
{
p3 = MultiSlider.x;
q3 = MultiSlider.x[0];
if (i==1)
{
Monitor.value = p3;
Monitor2.value = q3;
}
if (i==2)
{
Monitor3.value = p3;
Monitor4.value = q3;
}
}
And it could all be achieved with a loop anyway just straight assigns - not sure why you have chosen the looping . . .
I corrected mistakes you pointed but Monitors values still not moving.
loop_corrected.jzml
Full script contains large formula, without loop it will be repeated many times, and there is a limit of maximum strings in one script, and I'm not sure how to factor this formula out.And it could all be achieved with just straight assigns
loop_corrected.jzml