Using thispatcher object with cycle object

Mar 8, 2013 at 12:06am

Using thispatcher object with cycle object

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. –
Mar 8, 2013 at 6:05am

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. –
Mar 8, 2013 at 6:26am

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. –
Mar 8, 2013 at 7:24pm

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

Mar 9, 2013 at 9:45am

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;
Mar 9, 2013 at 10:57pm

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. –
Mar 10, 2013 at 6:09am

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

Mar 10, 2013 at 9:49am

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


You must be logged in to reply to this topic.