Need Help - Selecting a range between 2 number outputs

gbrewer's icon

I am working on a tangible interface where I can track the X & Y values of a symbol but I don't know how to set a range so that when the symbol goes within that range it triggers a bang.

e.g. trigger a bang if the symbol goes lower than a value of 60 for the X axis and higher than 440 on the Y axis.

Help would really be appreciated. Thanks.

Roth's icon

If I understand you correctly something like this should do it:

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

gbrewer's icon

Thats great thanks. How would I do it so that it will only output a bang if they are both in the correct area instead of a bang for each?

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

Is this what you mean?

gbrewer's icon

That is exactly what I was looking for, thanks mate!

Roman Thilenius's icon

i cant look at max5 code and i dont understand the given case, but something like
[code]
[strong]
[if ($f1>200)&&($f1300)&&($f2
[/strong]
[/code]

should do the job.

under circumstances you will prefer to do the opposite, and bang only when
the mouse leaves the wanted area.

good use of the [change] object should also be on your to do list for such
interface things.

-110

Roman Thilenius's icon

[if ($f1>200)&&($f1300)&&($f2

Roman Thilenius's icon
Roman Thilenius's icon

btw, (now that i found out about the markup code) you can also
combine the if_then logic with [clip]ing your X and Y values.

let me try this without looking at max - i am hopefully getting it
right offhand:

for X:

expr ( ($i1>$i3) && ($i1$i5) && ($i2

for Y:

expr ( ($i1>$i3) && ($i1$i5) && ($i2

inputs:

X mouse = $i1
X low limit = $i3
X high limit = $i4

X mouse = $i2
X low limit = $i5
X high limit = $i6

the two expression will output 0 when the condition is not met.

this means that you will have to add a [route 0] behind, and it also means
you cant use negative values (and also not 0 !)

-110