[CLOSED]Conditionals

Nov 9, 2012 at 10:48am

[CLOSED]Conditionals

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 <3 )

Attachments:
  1. Untitled1.jpg
#65135
Nov 9, 2012 at 10:58am

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…

– Pasted Max Patch, click to expand. –
#234786
Nov 9, 2012 at 11:01am

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

#234787
Nov 9, 2012 at 11:01am

Pardon me, but… ain’t this what you’re trying to achieve ?

– Pasted Max Patch, click to expand. –

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.

– Pasted Max Patch, click to expand. –
#234788
Nov 9, 2012 at 11:16am

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

[CLOSED]

#234789
Nov 9, 2012 at 6:09pm

[if $i1==0 then bang]

#234790
Nov 9, 2012 at 9:11pm

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

#234791

You must be logged in to reply to this topic.