Keeping a message intact going through cycle?

commathe's icon

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 :/

Luke Hall's icon

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

Roman Thilenius's icon

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

Jeremy's icon

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

5411.rotatorosx.zip
zip
Jeremy's icon

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

Best, Jeremy

Luke Hall's icon

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;

Max Patch
Copy patch and select New From Clipboard in Max.

//EOF

commathe's icon

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!