Forums > MaxMSP

questions about select

April 10, 2006 | 10:50 am

hi,

anyone know if there’s an object like select, but instead of banging out the
left it outputs the value?

i was looking for a more elegant way to do this…

max v2;
#N vpatcher 10 59 610 459;
#P window setfont "Sans Serif" 9.;
#P number 60 60 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 99 168 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 99 60 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 140 168 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 140 133 27 196617 int;
#P newex 60 94 49 196617 select;
#P connect 5 0 0 0;
#P connect 3 0 0 1;
#P connect 0 1 4 0;
#P connect 0 0 1 0;
#P connect 1 0 2 0;
#P connect 3 0 1 1;
#P pop;

thanks


robin


April 10, 2006 | 11:21 am


April 10, 2006 | 11:43 am

> anyone know if there’s an object like select, but instead of
> banging out the left it outputs the value?
>
> i was looking for a more elegant way to do this…

take a look at [if]

vb


April 10, 2006 | 11:58 am

tap.sieve, one of Tim Place’s Tap Tools, does exactly
that,
cheers
roger


April 10, 2006 | 12:09 pm

You may want to look at my "member" external. Essl ported it a while back
an includes it in his RTC library.

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


April 10, 2006 | 2:39 pm

thanks guys, loads of solutions – i’ll go with [if] for now, it’s just that
i haven’t ever got used to the syntax of it. now’s the time i guess


robin


April 10, 2006 | 3:06 pm

On 10 avr. 06, at 16:39, Robin Foster wrote:

> thanks guys, loads of solutions – i’ll go with [if] for now, it’s
> just that i haven’t ever got used to the syntax of it. now’s the
> time i guess

Not that difficult, here we have :

if $i1 != $i2 then out2 $i1 else $i1

which means :

if the number wich comes in the first inlet (left one) is not the
same as the number wich arrives from the right inlet, then the object
will send the value of the left inlet to the right outlet (out2),
else (if the 2 numbers are the same) the value of the first inlet
will be sent to the default outlet (leftmost).

best,
ej

#P window setfont "Sans Serif" 9.;
#P number 270 60 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 427 168 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 309 60 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 270 168 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 270 94 167 196617 if $i1 != $i2 then out2 $i1 else $i1;
#P connect 0 1 3 0;
#P connect 4 0 0 0;
#P connect 2 0 0 1;
#P connect 0 0 1 0;
#P window clipboard copycount 5;


April 10, 2006 | 3:21 pm

woohoo! i don’t even have to read about it now. thankyou!


robin


April 10, 2006 | 3:31 pm

On 10 avr. 06, at 17:21, Robin Foster wrote:

> woohoo! i don’t even have to read about it now. thankyou!

You’ll have to, because there’s many other useful features :-)

ej


April 10, 2006 | 4:10 pm

i think your [if] works, but i’m probably doing something extremely obvious
wrong with the right to left ordering.
basically i’m trying to make a simulated dice roll, where you roll, then
count up to that number, like you would on a board game, moving the player
over each square on the board – so if i rolled a six, i’d count one, two,
three, four, five, six. my patch then chooses another random number for the
next roll.
i need to then be able to seperate the count up from the actual number, so i
have 1,2,3,4,5 out one outlet, then the 6 out another.

a bit like this

max v2;
#N vpatcher 10 59 457 636;
#P origin 0 36;
#P window setfont "Sans Serif" 9.;
#P number 301 437 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 144 437 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 144 404 167 196617 if $i1 != $i2 then out2 $i1 else $i1;
#P number 144 364 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 242 165 27 196617 + 1;
#P newex 144 327 27 196617 + 1;
#P newex 155 282 35 196617 select;
#P newex 172 201 38 196617 t 0 i;
#N counter;
#X flags 0 0;
#P newobj 144 234 66 196617 counter;
#P number 172 165 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P button 172 106 15 0;
#P newex 172 136 52 196617 random 6;
#P number 112 106 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 64 65 15 0;
#P newex 64 136 58 196617 metro 500;
#P window linecount 2;
#P comment 278 364 45 196617 displays dice roll;
#P comment 180 364 61 196617 counts from 1 to random;
#P number 242 364 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P connect 4 0 3 0;
#P connect 5 0 3 1;
#P connect 3 0 9 0;
#P connect 9 0 12 0;
#P connect 12 0 14 0;
#P connect 14 0 15 0;
#P connect 15 0 16 0;
#P connect 9 0 11 0;
#P connect 4 0 7 0;
#P fasten 11 0 7 0 160 313 232 313 232 90 177 90;
#P connect 7 0 6 0;
#P connect 6 0 8 0;
#P connect 8 0 10 0;
#P connect 10 0 9 2;
#P fasten 8 0 11 1 177 190 219 190 219 267 185 267;
#P connect 10 1 9 4;
#P connect 6 0 13 0;
#P connect 13 0 0 0;
#P fasten 0 0 15 1 247 391 306 391;
#P connect 15 1 17 0;
#P pop;

except something doesn’t quite work every time.
if someone could have a quick look i’d be extremely grateful


robin


April 10, 2006 | 6:01 pm

oops! posted the wrong code. ignore that


robin


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