One bang when two separate unequal values are reached?

Milo 's icon

Hi there,
I thought this would be very simple but I can't find a way to do it.
I want an object that will send a bang only when two separate number boxes reach different values at the same time, if that makes sense. I've attached the patch so you can have a look.
Select would cause two bangs when both numbers are reached so that's no good.
Split wont work because I am not interested in a range, but two specific numbers.
Match basically works but it does not bang when the numbers are reached, at least when using number boxes. It will only bang when the numbers are typed and specifically sent to Match.
I had a look around for solutions using "zl" and "if" but could not work anything out.
Sorry if this is simple and I'm just missing something silly, but I can't figure it out.
Thanks!

Example.maxpat
Max Patch

Bill 2's icon

Check out [onebang]. Or [if $i1==8 && $i2==4 then bang].

Milo 's icon

Onebang had the same problem as match, but that "if" solution is perfect.
This will be very useful in the future, thanks Bill!

tmhglnd's icon

You could [pack i i] the 2 values, then use [zl.compare 8 4] > [sel 1].

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

Bill 2's icon

You're welcome, Milo. With some extra objects [match] and [onebang] do actually work:

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

So now you've got 4 solutions to choose between. :-)

Milo 's icon

Thanks again to you both. Using pack with match seems obvious now!