#0 to int within a subpatch

Apr 30, 2006 at 8:11pm

#0 to int within a subpatch

I need to collect the value associted with #0 in a subpatch and convert it
to int. I am sure I’ve done this before and thought one of these worked…

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 215 140 51 196617 tosymbol;
#P number 215 189 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 215 164 27 196617 int;
#P message 218 120 24 196617 $0.;
#P number 81 192 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 82 153 27 196617 int;
#P message 84 123 24 196617 $0.;
#P connect 6 0 4 0;
#P connect 3 0 6 0;
#P connect 4 0 5 0;
#P connect 0 0 1 0;
#P connect 1 0 2 0;
#P window clipboard copycount 7;

Cheers,
Gary Lee Nelson
TIMARA Department
Oberlin College
http://www.timara.oberlin.edu/GaryLeeNelson

#25729
Apr 30, 2006 at 8:26pm

hi gary. i did not load your patch in max, but looking at the text patch
it seems you have put a “.” after #0 (why?).. i believe this is what’s
causing the problem.

jm

#76067
Apr 30, 2006 at 8:29pm

hi gary,

maybe your memory converted the fromsymbol to a tosymbol ;-)

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 275 200 64 196617 fromsymbol;
#P number 275 249 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 275 224 27 196617 int;
#P message 275 174 24 196617 $0.;
#P connect 1 0 2 0;
#P connect 3 0 1 0;
#P connect 0 0 3 0;
#P window clipboard copycount 4;

jan klug

#76068
Apr 30, 2006 at 8:35pm

Well duh…maybe I’m getting too old for this. :-)

Thanks, Jan

Cheers,
Gary Lee Nelson
TIMARA Department
Oberlin College
http://www.timara.oberlin.edu/GaryLeeNelson

#76069
Apr 30, 2006 at 9:23pm

how dumb of me to not have open the patch.. but you didn’t answer my
question about why you put a dot after #0?? is there something i’m missing?

jm

#76070
Apr 30, 2006 at 9:36pm

> why you put a dot after #0??
>

that’s what i also thought, but when i tried it out it appeared that
max makes a $0 out of the #0 if there’s nothing attached to it;
gary’s method seems to be a nice workaround for this!

jan

#76071
Apr 30, 2006 at 9:40pm

Actually the “.” is what makes this possible. A “#0″ all by itself turns
into a “$0″ I DON’T know the answer to this. A “#0.” becomes perhaps
“1001.” which is a symbol. fromsymbol turns it into a float and int
converts it to the integer I need. Someone taught me this trick a year ago
and I remembered the “.” but misremembered the fromsymbol as tosymbol.

Cheers,
Gary Lee Nelson
TIMARA Department
Oberlin College
http://www.timara.oberlin.edu/GaryLeeNelson

#76072
Apr 30, 2006 at 11:09pm

Actually someone else get credit for this. I posted a query to the list and
this was the solution I received. Sorry I don’t remember who that kind soul
was.
Cheers,
Gary Lee Nelson
TIMARA Department
Oberlin College
http://www.timara.oberlin.edu/GaryLeeNelson

#76073
Apr 30, 2006 at 11:29pm

oh wow, very interesting! i usually use the “#0-whatever” method to give
unique names to objects and then truncate to just the 1001 value if i
need the value by itself. never knew about the dot thingee.. so much easier!

this has got to be the best max tip i got in along time, thanks!

jm

#76074

You must be logged in to reply to this topic.