sub-patch scripting

Oct 25, 2006 at 3:57am

sub-patch scripting

Hello,
I am wondering if there is a way to use scripts (or perhaps somethign else) to set,connect, discconct, elements in a subpatch at a certain time. Here is a simple not working example. Any inuput is greatly appreciated.
Cheers.

max v2;
#N vpatcher 549 484 1149 884;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#N thispatcher;
#Q end;
#P newobj 201 227 61 196617 thispatcher;
#P message 201 204 170 196617 script send down::numberBox set 5;
#P button 201 183 15 0;
#P number 201 133 35 9 0 10 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#N vpatcher 505 187 1105 587;
#P window setfont “Sans Serif” 9.;
#P number 327 173 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname numberBox;
#P pop 1;
#P newobj 366 269 70 196617 patcher down;
#P newex 201 159 46 196617 select 5;
#P connect 2 0 0 0;
#P connect 0 0 3 0;
#P connect 3 0 4 0;
#P connect 4 0 5 0;
#P pop;

#28339
Oct 25, 2006 at 6:46am

thispatcher only works w/ a given patcher if the thispatcher object is IN THE PATCH you want to demarcate as “this one”.

here’s a modified example:

#P window setfont Geneva 9.;
#P number 45 72 35 9 0 0 0 173 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#N vpatcher 505 187 1105 587;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#N thispatcher;
#Q end;
#P newobj 25 98 61 9109513 thispatcher;
#P message 25 75 133 9109513 script send numberBox set $1;
#P inlet 25 44 15 0;
#P number 327 173 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname numberBox;
#P connect 1 0 2 0;
#P connect 2 0 3 0;
#P pop 1;
#P newobj 45 110 70 9109513 patcher down;
#P connect 1 0 0 0;
#P window clipboard copycount 2;

#86889
Oct 25, 2006 at 10:50pm

You’d need to send the script messages to a thispatcher object inside the subpatch – via send/receive, forward/receive or the messagebox ‘send to a named object’ syntax or such.

Alternately, javascript can look inside a subpatch and add/remove/connect objects. There were examples posted, try a search for subpatcher()

#86890
Oct 27, 2006 at 6:01am

nick wrote:
> Hello, I am wondering if there is a way to use scripts (or perhaps
> somethign else) to set,connect, discconct, elements in a subpatch at
> a certain time. Here is a simple not working example. Any inuput is
> greatly appreciated. Cheers.

pattrforward can do it. (It could send also directly to the object)
In the modified example the subpatcher is named!

#P window setfont “Sans Serif” 9.;
#P window linecount 2;
#P newex 136 124 94 196617 pattrforward down::numberBox;
#P window linecount 1;
#P message 136 100 85 196617 set 100;
#P newex 35 136 98 196617 pattrforward down;
#P window linecount 2;
#P message 35 100 85 196617 inx script send numberBox set 5;
#P number 35 48 35 9 0 10 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#N vpatcher 354 191 954 591;
#P window setfont “Sans Serif” 9.;
#P number 327 173 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname numberBox;
#P pop 1;
#P newobj 82 182 70 196617 patcher down;
#P objectname down;
#P newex 35 74 213 196617 select 5 3;
#P window linecount 3;
#P comment 163 183 100 196617 < - this has to be named down to work with
pattrforward;
#P connect 1 1 6 0;
#P connect 3 0 1 0;
#P connect 1 0 4 0;
#P connect 6 0 7 0;
#P connect 4 0 5 0;
#P window clipboard copycount 8;


Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com

#86891
Dec 12, 2006 at 3:34pm

Thank you for your help and suggestions!
Greatly appreciated!

#86892
Dec 12, 2006 at 4:31pm

i remember seeing somewhere a subpatch initialized with arguments (#1). is
that possible?

On 12/12/06, nick wrote:
>
>
> Thank you for your help and suggestions!
> Greatly appreciated!
>

#86893
Dec 14, 2006 at 7:54am

yes;
the pound-sign argument will drive down into sub-patchers.

jl

#86894

You must be logged in to reply to this topic.