I need an object that sends 1 (or a bang) when a given condition is satisfied but a 0 (or nothing) if the condition is ever violated and continues to send zero until it is reset by a different condition (even if the first condition is satisfied again). Isn’t onebang supposed to do this? If so I am not using it right.
Here’s a way of doing it with onebang.
----------begin_max5_patcher---------- 681.3ocyW0zbaBCD8L7qPiN6lA8AAnW5zdqW6kdnSmLfQwQY.IFPN0sYx+8h jvwDapiLFb8EzHgzx6s6aWs7ruGLStg0.AeD7Cfm2y9ddlkzK30M2CVltYYQ ZiYavkxxRlPAWXemhsQYVOX6Jh0kbQASY1NpawpZVS6oRUbo3tZ1Rk8SRBw2 Dr.PiCzCae.94NSIWq1ZqftUuWJTM7+vL1We9tOQpZ4Cbwp9lmFYMOUOfRzO w8+.7bC1kYO9AbBrm8EokF6C+bMOs.7EYQNT+1W780OVblNKzQcVmKswIItS 63Yf1krllzUrCnciRVMHywCxbzoGvQFMD4Vrcvv+3dL2Zc0uqX1C.gC5TtcF bJYqUJoXTYITCQnTpCYIn2OcvZGbvA5hC7NYohUC6gnSotHXVEE3Di6C2oMv 2DNNQA4BloflWORX3j3QP+eRSbVv2E4mBAOJYJq++s17b0rdG.IxDhIgFpSI G6N.TzUdbjPi6QlyKNFNFxHX+p8vGdeFq.f.CW8hLHIIis5EwdMtsBtCbewt wg8CjKX6NemWT.9Jf8DqFjw.p50rOMuperoA.L03zPnniJ+wyfqPIWspfMok w5XiKxedaPXPp9pVsJstknJV8cLQZVg4fASWlgTvzxOvobOFdz4FIlncD5Dy MFxCcJsCaNOrfK1+OnLPUu9acbMx00K2hjs8YB1g1bVihKLc+0aSwuYOOvyy Yh9YE47Fc.L+eGAcEN5ZBs0yNNb1CyyNdthbOAN.m8v7rhmDWvS36fmRddkr sdQmDlDDp6FjFQrcNgObFw1NEIL50Y6.wjwtXWzhzKlyF6hVbOExrhGz0Edh cANIWtbiPGKcfFAbr08SqpZ6mooyjFjzd03ixZ8zaWXlxE1oFKBqYOw2t+Pe s0dw+uf+fHGr -----------end_max5_patcher-----------
Didnt even know that sel could have multiple arguments – very cool
Silly that there’s no other way to do this tho.
There are actually other ways of doing it. What you’re describing is an AND sort of process where the outcome is dependent on the state of two things. Here’s how to do it using &&. (you could also change togedge to sel 1)
----------begin_max5_patcher---------- 606.3oc2VsyaaCCDdV5WAAGxjZfHEksbVBZ25ZW5PQQfj0EGFHQZHRm51f7e uhmrrkcD7iZKihrHg6H4wu6i2qW88nY5kfgRti7Chm2q9ddnJmBuUxdzxzkS KRM31npEkYPEMnYoZIop.r3ZrMJ0KrsZ4qz9nVYMx+.3N42FtR87T6zmjpYO TASsM.IZhaYRTxH2u3P2Wd8WxOWclFqa+8bn4.ToxRCHzrT0L55cIyQ.qyd9 SQgz0WWUZIXgpG.UZVAZfvNHTUuJdrOWISKHeQWjScq9luu6SvQxRkfwjNCZ uUKrD8MZXuDGuWhicxDWLGINAWf7G+13.BKYeDWurEOld4YDE7qZa+NBwpmA 4aHpAIdRjH5FOM9vwSXfz9Bn3gWOJ5laFzflV1QjrIn4vYa8QJrjAfTlpKKA W58Nrx2.CXOgvlvSOaJJA4hIXAHQz6Ba555inWuhHrgMdXxXzsSlbVEQXL5G kxphDdya+3yqr5GmPDA6RPHQWwxEeWVTP9JAdApHY.wVs.teXqdDh0S4BroC iMdekODC.ST2YcVwozXkc3LfFmgejSj0mmFu2Aw53l3goER0timhvyoeae2n WTMs81a6FQ1fvbvXkpTqTq5rI2fgc1zSx7bP08AOWZbnKeW3Ebx3wMU0AwCB Z1dvSoLettlbMs8nXtjOQbTynM36y1RQQ7lwnGuVZCHtbdW3V.ueuaGJXHY6 i50me8d8iNB3b8XG9+UnwMpv4mYb4vyQmn9uPOM00RmOutSjYkMQjTW89Yck SbT.JJUMhnEoUvKx18G66r1a9+0gFloq -----------end_max5_patcher-----------
You’d think that there’d be an object that does this in one step, is all I’m saying. I’ve built a patch that seems to do a relatively simple thing (will post later on)but is IMO inordinately complex as it is. I’m starting to see the limits of trading flexibility for speed.
Whenever I hear a request for an object to do one specific thing I get suspicious. There isn’t a word for every thought, sometimes you have to use sentences. Do you need to do this sort of thing very often?
Do you _really_ need the speed that a native object would give for this? An abstraction would get you the same clarity of intent as an external object would.
finding different solutions for it depending on the concrete situation is the way to go.
to find out if one of up to 8 conditions are met
[expr (condition 1) * (condition 2) * (condition 3) * (condition 4) * (condition 5)]
should be the most straightforward solution.
and if you make bigger projects, you will eventually need to analyze the state of
buttons or things like that which are all but linear and contain various serial and
paralell processes- then the use of a bunch of basic objects like &&, >, route and
gate can be the best way.
in jamessons problem from above, [gate] would be the first object i´d put in my patch.
Roman’s multiplication idea is great – saves on complex && newroks
You can also use things like: vexpr $i1!=0 –> zl sum –> == (list length–use zl len)
if you want to evaluate whole lists of conditions.