matrixctrl and change
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?
Have a look at [zl change], it is like [change] but for lists.
lh
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.
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?
lh
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
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
// lh.mchange
var rows = jsarguments[1];
var cols = jsarguments[2];
var mem = [];
clear();
function clear() {
for (i=0; i
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...
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.
thanks.
and i'm not using it for interface so don't need the deferlow!
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
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].
lh
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.
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:
reference here: https://cycling74.com/forums/external-of-simple-js