comparing values

jhdkfj39929's icon

Why do these not work? How can I check if a value is within range?

I am managing to sent out a bang but how can I send a specific value?

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

Thanks.

Chris Muir's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Maybe split?

jhdkfj39929's icon

Nice, thanks. Good to know. The only thing is I need to output 1, 2, 3 and 4 in order to control Gate object with it. How please?

I would also like to understand why my expressions were not working.

And here is my attempt with comparison operators. This one also does not work.

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

Thank you very much.

Noob4Life's icon

if then needs a little getting used to, doesn't always work like C (i had better luck making sure $f1 variables were towards the left among other things like being explicit about everything, etc.
i'm having trouble explaining...

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

if you can use comparison operators, that might be more efficient but here's a little of both(you could easily rework the ifthen here for your question about outputting 1 through 4 for gate), hope it helps:

________________________________
*Never fear, Noob4Life was never here!

jhdkfj39929's icon

Thank you. Very useful. But they still output bangs, how do I get from a bang to an int? And output that int only once for each range of values?

Sorry about the primitive questions, I am finding it a bit hard to get through the simplest things sometimes because I am not familiar with MAX's idiosyncrasies and the doc's examples cannot cover everyone's precise scenario...

Chris Muir's icon
Max Patch
Copy patch and select New From Clipboard in Max.

I still think split makes sense for this problem.

In your example with all the >< operators, it looks like you're trying to set a range with each pair, but you have your range improperly specified.
For example, you're looking for a number that is < -5.36 AND > -2.68, which is not going to happen. If you swap the operators so that you are looking for > -5.36 AND < -2.68 you will spacify a range.

jhdkfj39929's icon

Very nice. Thanks a bunch, Chris.

Roman Thilenius's icon

you can come from bang to int using [i], [t], [var], [pvar], [zl reg], [sprintf], [text],
[coll], [expr], gui objects, java or javascript, or about 30 other ways ... choose one!

my choice would be trigger: [t 4]

-110

jhdkfj39929's icon

Thanks. I knew it was the case but helps to know what to look for.