comparing values

Oct 15, 2010 at 3:42am

comparing values

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?


– Pasted Max Patch, click to expand. –
Oct 15, 2010 at 4:13am

Maybe split?

– Pasted Max Patch, click to expand. –
Oct 15, 2010 at 4:22am

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.

Thank you very much.

– Pasted Max Patch, click to expand. –
Oct 15, 2010 at 5:31am

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…

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:

– Pasted Max Patch, click to expand. –

*Never fear, Noob4Life was never here!

Oct 15, 2010 at 7:05am

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…

Oct 15, 2010 at 7:14am

I still think split makes sense for this problem.

– Pasted Max Patch, click to expand. –

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.

Oct 15, 2010 at 10:48am

Very nice. Thanks a bunch, Chris.

Oct 15, 2010 at 7:26pm

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]


Oct 15, 2010 at 11:20pm

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


You must be logged in to reply to this topic.