Forums > MaxMSP

instance value genrated by a #0 in a bpatcher ?

April 26, 2007 | 10:59 am

bonjour,
how to get the instance value generated by a #0 in a bpatcher ?
how do i extract its value from an object such as a [send #0_something] so i can use this value outside of the bpatcher ?
thanks in advance


April 26, 2007 | 12:58 pm

I don’t know exactly what you’re trying to do. Do you just want to get the number value from the bpatcher to be able to send messages to it? Here’s an example:

main patch:

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 376 139 62 196617 prepend set;
#P number 325 81 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 376 86 33 196617 r init;
#P message 376 162 85 196617 send 2786_ok;
#P newex 376 111 91 196617 sprintf send %sok;
#P newex 325 162 47 196617 forward;
#P bpatcher 57 38 235 232 0 0 bpatch 1;
#P connect 4 0 2 0;
#P connect 2 0 1 0;
#P connect 2 0 6 0;
#P connect 6 0 3 0;
#P connect 5 0 1 0;
#P window clipboard copycount 7;

save as bpatch:

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 159 40 48 196617 loadbang;
#P newex 45 81 74 196617 print incoming;
#P message 159 66 29 196617 $0_;
#P newex 159 92 33 196617 s init;
#P slider 22 81 15 128 0 1;
#P newex 22 37 47 196617 r $0_ok;
#P connect 0 0 1 0;
#P connect 0 0 4 0;
#P connect 5 0 3 0;
#P connect 3 0 2 0;
#P window clipboard copycount 6;

One other thing: There must be a (any) character behind the #0 message, otherwise it doesn’t work (you can try this).

If you’re using many bpatchers (as #0 suggests), you must build something to keep track of the numbers, use a coll for example.


April 26, 2007 | 1:08 pm

> One other thing: There must be a (any) character behind the #0 message, otherwise it doesn’t work (you can try this).
>
> If you’re using many bpatchers (as #0 suggests), you must build something to keep track of the numbers, use a coll for example.
>
>
>
—————————————————-

thanks a lot that is exactly what i was aiming for and trying to do. and i of course forgot about adding a symbol after the #0 to get the instance value when loading as you did here :

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 166 47 48 196617 loadbang;
#P message 166 73 29 196617 $0_;
#P newex 166 99 33 196617 s init;
#P connect 1 0 0 0;
#P connect 2 0 1 0;
#P window clipboard copycount 3;

best,


April 26, 2007 | 7:06 pm

karl-otto von oertzen schrieb:
> thanks a lot that is exactly what i was aiming for and trying to do.
> and i of course forgot about adding a symbol after the #0 to get the
> instance value when loading as you did here :

And in case you need the #0 as number, you can do this:

#P window setfont "Sans Serif" 9.;
#P number 81 192 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 45 163 68 196617 fromsymbol;
#P message 82 69 42 196617 1234_;
#P newex 45 141 50 196617 itoa;
#P newex 45 118 50 196617 zl ecils 1;
#P newex 45 95 50 196617 atoi;
#P newex 45 43 48 196617 loadbang;
#P message 45 69 29 196617 $0_;
#P newex 45 191 33 196617 s init;
#P connect 7 0 0 0;
#P connect 7 0 8 0;
#P connect 5 0 7 0;
#P connect 6 0 3 0;
#P connect 4 0 5 0;
#P connect 3 0 4 0;
#P connect 1 0 3 0;
#P connect 2 0 1 0;
#P window clipboard copycount 9;


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


April 26, 2007 | 8:03 pm

Quote: (karrrlo) wrote on Thu, 26 April 2007 04:59
—————————————————-
> bonjour,
> how to get the instance value generated by a #0 in a bpatcher ?
> how do i extract its value from an object such as a [send #0_something] so i can use this value outside of the bpatcher ?
> thanks in advance
>
>
—————————————————-

a simple [loadbang]-[#0]-[outlet] should work, because the
arguments to a subpatcher are always initialised first.

if [loadbang]-[#0]-[outlet] does not work for you then
try [loadbang]-[#0]-[pipe 0]-[outlet]


April 27, 2007 | 12:57 am

Thanks Stefan and Roman, your solutions work just fine
i have it all figured out now. it was simple indeed ;)
best,


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