Help with if statements

tomslater's icon

Hello,

I need to specify a range of x, y coordinates on a touch screen ie, if a touch event occurs between pixels x100 and x150 and y500 and 450 then something happens.

I have tried the following

if $i1 > 100 || $i1 < 150 then $i1

This seems to do nothing to the incoming integer. Is there a "between" type function for the if object?

Jeff Thompson's icon

The "split" object does just that!

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

Here's one way

brendan mccloskey's icon

The probelm is the logical distinction between 'or' and 'and'; all integers are either >=100 OR 100 AND 100 && $i1

Brendan

[edit] just looked at Simon's response, doh.....

ps, did I leave enough space between "and and 'and'" ;)

Simon's icon

@n00b_meister - Har har do that space/syntax tango all the time, part of the fun... err maybe ;-)

tomslater's icon

Perfect, thanks people