Conditional Handling of Data Streams

Jan 12, 2011 at 7:30pm

Conditional Handling of Data Streams

Hello,

I am looking to build a rather involved framework of bangs and triggers based on the combined states of the values of two independent, three axis accelerometers. The if/then object works great for some tasks, especially when I am comparing values, but if I want to also say, if $i1>400 && $i2<100&& $i1>500 && $i3>0 && $i4>300 && $i5<400 && $i6>400 then 1 else 2, it doesn’t work. There is also the problem that to make a large amount of such of triggers, I will be sending the information to potentially over a 100 hundred if/then objects depending on how many differentiated relationships I can construct. I am hoping there is some easier, text based way of making a big list with all of these possibilities and then assign an individual ID number for each one, to be separated later by a select object. Any suggestions?

Thanks!

#54379
Jan 12, 2011 at 8:31pm

That sounds like something you’d be much better off doing in a procedural context, like the js object.

#195761
Jan 13, 2011 at 10:10am

“but if I want to also say, if $i1>400 && $i2<100&& $i1>500 && $i3>0 && $i4>300 && $i5<400 && $i6>400 then 1 else 2, it doesn’t work”

what does not work? there is nothing wrong in this statement.

#195762
Jan 13, 2011 at 12:06pm

There is nothing wrong, but $i1 > 400 is useless as there is also a $i1 > 500 in the expression.

#195763
Jan 13, 2011 at 1:08pm

Hi,

So the statement works fine when I correct the redundant/illogical double $i1 thing. My bad. Otherwise, the js object procedural context sounds interesting if I was going to avoid a jungle of if/then objects. I have never programmed in Java. Does anyone have any similar examples that might demonstrate if this would be a fruitful avenue of study?

#195764
Jan 13, 2011 at 6:19pm

Doing the above with a jstrigger is easy.

– Pasted Max Patch, click to expand. –

If you want to do some real procedural js, though, just create a [js] object and open up the help patch and reference in the documentation. It shouldn’t take you long to figure out how to do some basic js logic objects.
`

#195765
Jan 13, 2011 at 7:04pm

Thanks for the patch, EasyMac. I think working with procedural js willl eventually be an amazing tool in expanding my Max patching. I will have to do my homework though; lot’s of possibilities there.

Just when I thought I was beginning to know Max…

#195766

You must be logged in to reply to this topic.