Page 1 of 1

"For" loop problem

Posted: 29 Aug 2013 10:20
by hodok
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?
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;
}
}

Re: "For" loop problem

Posted: 29 Aug 2013 13:17
by hodok
BTW it works if you reduce p3 and q3, but I can't do without them.

Re: "For" loop problem

Posted: 30 Aug 2013 07:05
by hodok
:cry:

Re: "For" loop problem

Posted: 04 Sep 2013 02:42
by Macciza
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 . . .

Re: "For" loop problem

Posted: 08 Sep 2013 05:04
by hodok
I corrected mistakes you pointed but Monitors values still not moving.
And it could all be achieved with just straight assigns
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.