matrixctrl and change

    Aug 18 2009 | 11:39 am
    i would like a matrixctrl object only to output if a value changes.
    so, if the top left button is lit, sending "0 0 1" will not output anything, but sending "0 0 0" will change the value and output accordingly.
    any way to achieve this?

    • Aug 18 2009 | 11:45 am
      Have a look at [zl change], it is like [change] but for lists.
    • Aug 18 2009 | 12:03 pm
      well, but i would need one [zl change] object for every cell in the [matrixctrl], plus the need to organise the data-flow suitably.
      i'm looking for a nicer solution.
    • Aug 18 2009 | 12:11 pm
      The patch below blocks sending repeated lists, try clicking on some cells and then hitting the message box above the [matrixctrl] to re-send the last value, notice that it isn't printed. Is it not what you are trying to achieve?
    • Aug 18 2009 | 12:21 pm
      in this case i would like the output to read:
      print: 0 0 1 print: 1 2 1
      but it doesn't, [zl change] does not help here.
      as i said, to use [zl change] i would need one per cell in the matrix
    • Aug 18 2009 | 12:57 pm
      Ah now I see. You want it to be aware of all [matrixctrl] states and not just the previously sent one. Here's a javascript that should work if you load it into a [js] and give it the number of rows and columns in your [matrixctrl] as arguments. I hope it helps.
      // lh.mchange
      var rows = jsarguments[1];
      var cols = jsarguments[2];
      var mem = [];
      function clear() {
          for (i=0; i
    • Aug 21 2009 | 2:25 pm
      This trick using pattr comes in handy for most UI objects without a dump... The deferlow is necessary because the order of execution seems different for sending list and clicking into the matrixctrl...
    • Aug 21 2009 | 4:03 pm
      very interesting.
      the matrixctrl will dump everything on a bang, but with pattr it's in a different form and happens when any change is made, without needing a bang.
    • Aug 21 2009 | 4:06 pm
      and i'm not using it for interface so don't need the deferlow!
    • Aug 23 2009 | 3:57 pm
      found a hiccup with this.
      sending a "clear" message to the [matrixctrl] outputs weird stuff when going via [pattr], not sure exactly what's going on yet, but it breaks the solution for me
    • Aug 23 2009 | 4:26 pm
      Have you tried the javascript patch I posted above? If it didn't work let me know what happened, it shouldn't behave any differently when the "clear" message is sent to [matrixctrl].
    • Aug 23 2009 | 5:37 pm
      the problem with running javascript is that i don't really want to be running a bunch of scripts to fix odd bits where max falls short.
      if i'm going to be running some js for a patch then i might as well do the whole thing in js. whenever i start doing stuff in code again i wonder why i'm using max because a lot of the time it feels like such a pain (things like right-to-left).
      then if i'm just going to do the whole thing in js then why am i even running max at all?!
      the js solution is fine but i'd rather stay in max if possible.
    • Aug 24 2009 | 6:51 am
    • Aug 25 2009 | 3:01 pm
      what i want to do is retain the functionality of matrixctrl but simply add something that will filter duplicate output.
      i don't want to break any of the functionality of matrixctrl.
      i don't want to offer alternative methods for something like "clear" as a workaround for breaking it in the first place. if i'm doing this then i may as well not use matrixctrl and build the same functionality from the ground up (in js or whatever).
      i think this has got it:
    • Jun 13 2010 | 8:56 am