Forums > MaxMSP

Keeping a message intact going through cycle?

April 11, 2013 | 2:12 pm

Hey everyone,

I’ve run into an issue with the cycle object (not cycle~). I want to send a "bgcolor x x x x" message through it to color certain parts of my gui but the cycle object cuts the message and sends "bgcolor" and then each of the numbers out seperately. If I add quotations then it’ll keep the whole thing together but the objects receiving the object can’t parse it. Am I just going to have to suck it up and use stacks and stacks of separate message boxes? Cycle seems like it would have been such a nice, clean solution :/


April 11, 2013 | 2:23 pm

Have a look at [tosymbol] and [fromsymbol] which will combine messages into a single string and then split them out again.


April 12, 2013 | 12:49 am

or build your own cycle patch using [counter] and [gate]


April 12, 2013 | 7:23 am

My "rotator" external allows you to enable/disable list separation. FAT OSX .mxo attached until I’ve had time to update my tools page.

Best, Jeremy

Attachments:
  1. rotatorosx.zip

April 12, 2013 | 7:25 am

Also the jit.cycle object leaves lists intact. If I recall, it’s basically the same code as rotator.

Best, Jeremy


April 12, 2013 | 7:53 am

Here’s a javascript that will (hopefully) do what you want:

// lh.cycle.js

outlets = jsarguments[1];

var mode = (jsarguments[2]>0);
var t = new Task(timer);
var i = 0;

function anything() {
if (mode) {
if (t.running) {
t.cancel();
}
t.schedule(100);
}
outlet(i++ % jsarguments[1],arrayfromargs(messagename,arguments));
}

function timer() {
i = 0;
}

function set(x) {
i = Math.min(Math.max(x,0),jsarguments[1] – 1);
}

function thresh(x) {
mode = x;
}

autowatch = 1;

//EOF

– Pasted Max Patch, click to expand. –

April 15, 2013 | 2:38 am

Thank you everyone! All of your responces were really helpful. I ended up going with a [route] based solution in the end, but I learnt a lot from your responces!


Viewing 7 posts - 1 through 7 (of 7 total)