[CLOSED]Conditionals

Sev's icon

THANKS. This is sorted!
.
.
.
.
.
ewww. I shall not say more than enjoy ;)

I understand there is a missing not like there is no easy way of saying "not 0". I think before you ask the greater question of what am I trying to accomplish, first just look at this patch. There is the top left value that is meant to be changed.

[1] First question the program is asking is this value equal to 12, if yes then return 1 else return 0.
[2] If conditionalA returned 1 then bang THE BANG (LEFT side)
[3] If conditionalA returned 0 then turn on this toggle that is connecting the variable to the rest of the program (aka out put this variable that is not 12)

What seems to be happening is that no matter what, the LEFT side is always true. At least THE BANG is banging away even when the output of conditionalA is returning 0 (as if 0==1).

Am I seeing a bug or did I miss something on the usage of the object ==?

(PS: your pick of an image or the max page to download

4636.Untitled1.jpg
jpg
Stephane Morisse's icon
Max Patch
Copy patch and select New From Clipboard in Max.

This is normal : [==] outputs 0 or 1 depending if it's true or not, but both trig the bang. Add a toggle and you will see what I mean...

andrea agostini's icon

Hi.
To perform a logical not, just use [== 0] - if it's 0 then 1, else 0.
For the rest, frankly I don't think there's any bug in the Max conditionals - you just have to understand better some basic Max concepts: e.g., a conditional always returns a message, 1 or 0. If you connect a button to its outlet, it will be triggered anyway, as any message triggers it. If you want your button to be only triggered by a "true" (that is, 1) you can use [sel 1]...
My advice is, spend some time on the first six or so Max tutorials, and this stuff should become clear!
hth
aa

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

Pardon me, but... ain't this what you're trying to achieve ?

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

That beeing said, in your patch the problem is that the [button] (aka graphic bang) doesn't care what he receives, if it's 1 or 0, he will always output a bang. You need to check first if the value coming outa the test is a 0 or a 1.

Sev's icon

Thanks vichug, that sorts my issues. My knowledge set of Max's objects are quite limited.

[CLOSED]

Roman Thilenius's icon

[if $i1==0 then bang]

vichug's icon

in this case [if $i1==12 then bang else $i1] =)