Forums > MaxMSP

Using thispatcher object with cycle object

March 8, 2013 | 12:06 am

Anyone have any experience with using the thispatcher object with the cycle (no tilde) object?
I am trying to get thispatcher to create a named instance of cycle, but it keeps thinking that @varname is an extra attribute.

Any ideas?

– Pasted Max Patch, click to expand. –

March 8, 2013 | 6:05 am

hello rs-232…very interesting! but as you can see in this patch it s irrelevant with the thispatcher object…also it s beyond cycle as the same happens to many other objects which cannot take as argument directly the "varname"… i am very curious to learn why this happens…

– Pasted Max Patch, click to expand. –

March 8, 2013 | 6:26 am

and now i see that none non- UI object can take "varname" as argument directly… you can create an "uzi @varname pluxi" object but uzi does not accept "pluxi" as his varname as you can see on the inspector unless you send it with a message "sendbox varname pluxi"…i don t know if this is the normal behavior..

– Pasted Max Patch, click to expand. –

March 8, 2013 | 7:24 pm

Thanks tada, what I’m gathering here is that thispatcher seems to really be meant only for UI and non UI object just work spottily if at all. Really unfortunate, because you have to connect the UI to something, and if you are trying to dynamically generate functionality within a patch as I am trying to do, it becomes almost more trouble than its worth. : /


March 9, 2013 | 9:45 am

Have you thought of using javascript to create objects? I find it much easier, especially if the [thispatcher] route starts becoming complicated. Here’s an example that will accept the following message: "create", x co-ordinate, y co-ordinate, object name, argument1, argument2… argumentx, varname. The final item in the list will be used as the new object’s scripting name. Perhaps an example is best. Save the javascript below and then send it the message "create 100 100 cycle 5 wasabi" et voilà!

function create() {
    var args = arrayfromargs(arguments);
    var varname = args.splice(args.length-1);
    var obj = this.patcher.newdefault(args);
    obj.varname = varname;
}

March 9, 2013 | 10:57 pm

You can’t name no-UI objects with the varname attribute, as you discovered. But you can create a newobj object which is the UI object which hold any non-UI object, like this:

– Pasted Max Patch, click to expand. –

March 10, 2013 | 6:09 am

Yes, the examples in the MAX docs describe that javascript is the way.


March 10, 2013 | 9:49 am

thanks Emmanuel…someone doesn’ t read his lesson well as as he should do …it s inside thispather help…


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