Certain sequence of bangs trigger bang on output?

Fryc H's icon

Hi,
Is there an object in Max 7 that triggers a bang or a set message on output, ONLY after it receives a specific sequence of bangs?

Christopher Dobrian's icon

Yes. onebang requires a bang in the right inlet before a bang in the left inlet will be passed. You can link a series of onebang objects to get a longer sequence of required bangs, like this:

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

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

here a simple version with counter

Fryc H's icon

Hi! This helped me a lot in figuring it out, thanks!!! However I've got further issue because I need to do something similar to the onebang object with 4 elements. I need them to bang in a SPECIFIC order. Unless it happens in a specified order, an output bang can't happen. For example:
(1st bang) must happen first, then (2nd bang), then (3rd bang), then (4th bang) triggers. The whole thing resets if f.e. (3) comes before (2) etc. There must be ONLY FOUR bangs in this order so we could have an output bang. Any other option like (1) - (2) - (4) then going back to (3) and then (4) can't be allowed.
Is it possible to achieve something like that? I've been trying to figure it out for quite some time but came to nothing yet.
Thanks in advance!

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

Maybe turn the 4 bangs into numbers 1 to 4 then use the [match] object with the appropriate argument? Like so:

Fryc H's icon

Al right I think I figured it out with A LOT of wiring with stop messages to onebang objects :D

Fryc H's icon

However this match object is very neat and coud have saved a lot of my thinking. I am going to remember it. Thank you!

Bill 2's icon

You're welcome. :-)

I'm still pretty much a beginner and occasionally discover an object, or another feature of an object I already knew about - usually on this forum - that makes me go back and re-do my past work. So I know the feeling!