Conditional Handling of Data Streams
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?
That sounds like something you’d be much better off doing in a procedural context, like the js object.
"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.
There is nothing wrong, but $i1 > 400 is useless as there is also a $i1 > 500 in the expression.
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?
Doing the above with a jstrigger is easy.
----------begin_max5_patcher---------- 721.3oc4W11aaBCDG+0jOEm3EcsRrJLPA1TUklz9Hr2UglbfKItCrivl1lU0 u6y1.MoOPBscIZUSUxXNNa++946hcuahi6TwsnzE9JbI33b2DGGqIiAmt2cb qn2lWRkV2byEUUHW4509MEdqxZ+akJrlSUrqwxUdfZASB2vJKgoT9byq5VBH p65F.Bd4J3lEHWaAgZT1Tp.wL3JoplMeNVC4KzCEkvrZQEnpaPPIfYzRIZlm 1NZKlu3ALtTgzByLLiUaVBZ6ROS6KdMVuROOzJ7T.9NtD4EFWDbsBnJXkn4S 0HTHzF6zdEa9BELEgJg9KxFlhNsDOsOtKYbLWzvsAeZmwkTUtI59YMlqZgZX bxo9dPRnokjDXePz1frtAwJr7SL8pOGlzO8yDbEWq1VzVynk8eg2Tw3knxta P1vcI62V2Il03AeEMpdm6stTyZ8NndqRv2ToIQVwEYkpeWCjYFz8SlXZ7dm4 H+XmIE1MKZ9BnjIUajJnkIpyrjuH9CGF+owV5G2FYDyinzAfe7dE9uALVgRI cN9LL1wM2gC6ft7s.61XjMEjLTbG7Ji6fWSb2CoVSpUKwVE559lxr1NRB1BR B8SMT3KIifHgefHBGuQq4mCDwbrXMnFNGI1hkyr09A9uLPBB2mkFACADyOR3 508bOjtrsJHR5nKfH+mT.EL15GB4ie8iDK0mL4uyLj1xmn3sU9jtOqdBGU0i 2eY7rjl+Kfs9ucWIYO6Ueb7YCyoW6seh+2KsY8MVN9X5k9YWD46exQGo6SxN mz2OH6htdgYWD1aMJ67G79r1QdxN4ZXXa9GYaIfj8YB3HAqUW16s8j+cCanY r+XZKEM048SUWP.qitBTpXb6cX2vGyAUa3zBVQAx27tuUrhk5K4q5zv.a8iU ROY4dYMYte0gVSjcooCKmRFAlHGTEMljozCphRGCiBN3RZWYRj2y9l9k6m7G zxq6o. -----------end_max5_patcher-----------
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.
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…
Forums > MaxMSP