Conditional Handling of Data Streams

    Jan 12 2011 | 7:30 pm
    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 && $i2500 && $i3>0 && $i4>300 && $i5400 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?

    • Jan 12 2011 | 8:31 pm
      That sounds like something you'd be much better off doing in a procedural context, like the js object.
    • Jan 13 2011 | 10:10 am
      "but if I want to also say, if $i1>400 && $i2500 && $i3>0 && $i4>300 && $i5400 then 1 else 2, it doesn't work"
      what does not work? there is nothing wrong in this statement.
    • Jan 13 2011 | 12:06 pm
      There is nothing wrong, but $i1 > 400 is useless as there is also a $i1 > 500 in the expression.
    • Jan 13 2011 | 1:08 pm
      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?
    • Jan 13 2011 | 6:19 pm
      Doing the above with a jstrigger is easy.
      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. `
    • Jan 13 2011 | 7:04 pm
      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...