"For" loop problem

Discuss Lemur and share techniques.
Post Reply
hodok
Newbie
Posts: 21
Joined: 15 Jan 2013 14:39

"For" loop problem

Post 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;
}
}
Attachments
loop.jzml
(5.34 KiB) Downloaded 87 times
hodok
Newbie
Posts: 21
Joined: 15 Jan 2013 14:39

Re: "For" loop problem

Post by hodok »

BTW it works if you reduce p3 and q3, but I can't do without them.
hodok
Newbie
Posts: 21
Joined: 15 Jan 2013 14:39

Re: "For" loop problem

Post by hodok »

:cry:
Macciza
Regular
Posts: 1315
Joined: 07 Dec 2011 04:57
Location: Sydney, Australia.

Re: "For" loop problem

Post 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 . . .
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
hodok
Newbie
Posts: 21
Joined: 15 Jan 2013 14:39

Re: "For" loop problem

Post 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.
Attachments
loop_corrected.jzml
(5.34 KiB) Downloaded 90 times
Post Reply