## "permatoggle" object

May 15, 2012 at 5:22pm

# "permatoggle" object

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.

#63614
May 15, 2012 at 5:48pm

Here’s a way of doing it with onebang.

– Pasted Max Patch, click to expand. –
#229297
May 15, 2012 at 6:15pm

Didnt even know that sel could have multiple arguments – very cool

#229298
May 15, 2012 at 6:22pm

Silly that there’s no other way to do this tho.

#229299
May 15, 2012 at 7:09pm

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)

– Pasted Max Patch, click to expand. –
#229300
May 15, 2012 at 8:05pm

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.

#229301
May 15, 2012 at 10:34pm

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.

#229302
May 17, 2012 at 12:21pm

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.

-110

#229303
May 17, 2012 at 7:14pm

Roman’s multiplication idea is great – saves on complex && newroks

#229304
May 17, 2012 at 7:42pm

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.

#229305

You must be logged in to reply to this topic.