How to output desired numbers

vze1mk7d's icon

Hi. I was wondering if there was an object that you could specify what numbers to look for and when it received them, to output that number. Kind of like [select] except instead of outputting a bang it would output the number it was looking for. I know how to do this with a combination of different objects but I thought there should be a way with just one object. Maybe there is external that I don't know about or maybe I'm missing something. Thanks for your help.

Chris Muir's icon

On Mar 25, 2008, at 9:24 PM, Theo wrote:
> I was wondering if there was an object that you could specify what
> numbers to look for and when it received them, to output that number.

Split sort of does this.

Chris Muir
cbm@well.com    
http://www.xfade.com

Gregory Taylor's icon

>I know how to do this with a combination of different objects but I thought there should be a way with just one object. Maybe there is external that I don't know about or maybe I'm missing something.

Best to abandon the notion that there is

a. only one way to do almost anything in Max
b. there is a single object that will perform any arbitrary task

early on. These two notions won't serve you well. In my
experience it's best to think about what kinds of data
you're trying to test or compare, and what you want to
do with it [and whether you might not want to do a
couple of things with the data later on], etc.

If you've got single object fever, why not make yourself
an abstraction? You'll probably want this again.

vze1mk7d's icon

Thanks to both of you. I took both of your guys advice and I made an abstraction using split. Here it is in case you are interested.

Max Patch
Copy patch and select New From Clipboard in Max.

Bas van der Graaff's icon

I'd make something like this slightly more general like below, so it will have some more uses.
Oh, and in this case there is a single object that does it: zl sect

Max Patch
Copy patch and select New From Clipboard in Max.

vze1mk7d's icon

Hey thanks. That is a better way of doing it. Also, I looked at the help file and the manual and it doesn't say anything about zl sect and how you can specify specific numbers to output. But anyways that is awesome and thank you very much.

Quote: Bas van der Graaff wrote on Wed, 26 March 2008 03:55
----------------------------------------------------
> I'd make something like this slightly more general like below, so it will have some more uses.
> Oh, and in this case there is a single object that does it: zl sect
>
> #P window setfont "Sans Serif" 9.;
> #P number 442 183 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P window linecount 1;
> #P newex 442 148 76 196617 zl sect 1 4 7 9;
> #P number 442 116 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P outlet 321 277 15 0;
> #N comlet list of numbers to let through;
> #P inlet 249 45 15 0;
> #P newex 249 67 85 196617 unpack 0 0 0 0 0;
> #P newex 269 217 62 196617 split $5 $5;
> #P newex 217 190 62 196617 split $4 $4;
> #P newex 165 163 62 196617 split $3 $3;
> #P newex 113 136 62 196617 split $2 $2;
> #P newex 61 109 62 196617 split $1 $1;
> #N comlet number to be checked;
> #P inlet 61 45 15 0;
> #P outlet 61 277 15 0;
> #P connect 11 0 12 0;
> #P connect 10 0 11 0;
> #P connect 1 0 2 0;
> #P connect 2 0 0 0;
> #P connect 3 0 0 0;
> #P connect 4 0 0 0;
> #P connect 5 0 0 0;
> #P connect 6 0 0 0;
> #P connect 7 0 2 1;
> #P connect 7 0 2 2;
> #P connect 2 1 3 0;
> #P connect 7 1 3 1;
> #P connect 7 1 3 2;
> #P connect 3 1 4 0;
> #P connect 7 2 4 1;
> #P connect 7 2 4 2;
> #P connect 4 1 5 0;
> #P connect 7 3 5 1;
> #P connect 8 0 7 0;
> #P connect 7 3 5 2;
> #P connect 5 1 6 0;
> #P connect 7 4 6 1;
> #P connect 7 4 6 2;
> #P connect 6 1 9 0;
> #P window clipboard copycount 13;
>
----------------------------------------------------

Peter McCulloch's icon

Another way of solving it: (though zl sect works just fine)
If you're using ints, you could use coll. Store new values into it
using message box with the message "$1 $1". When you send a single
value in, coll will output it if it contains that index. Won't work
with floats, however.

Peter McCulloch