If statement not switching btwn movies

jiji's icon

Hi, I'm trying to switch videos depending on the value from an arduino input which i can do fine when I simply switch but is not working when I use the if statement. Can anyone help?

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

pdelges's icon

if is an object, not a message. A new object is created when pressing the "N" letter on your keyboard while a message is created with a "M".

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

Anyway, for your patch, I'd use a sel:

jiji's icon

Thanks for pointing out my use of M instead of N Patrick - this had me really puzzled. I am going to stick with the if statement though because I need to stream the inputs according to ranges so I am using 2 if statements and one split object.

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

jiji's icon

I've got the if and split objects working fine with imovie (see post above) but am trying to apply the same logic to a jit.qt.movie unsuccessfully. I'm going to post this issue in the jitter forum too as I'm not sure where the problem lies. Any ideas? Thanks

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

DiGiTaLFX's icon

Should the 2nd if statement actually be a > rather than a

jiji's icon

Yes it should but that's not the problem. I just can't get the if objects to work but the split object is working so I'm going to replace the ifs with splits. Thanks for responding anyway.

jiji's icon

Kurt Kalske came up with this response which works - Thanks again Kurt:

"There were two errors in your patch. The "if" statement requires a typed variable, "$i1" instead of just "$1".
Also there's a logic error: you want to test when your variable transitions into the next chosen range, not constantly reporting what range it is in. Try the example below.

Multiple boolean conditions are very difficult in Max. I tend to do this sort of thing in Javascript, because it's much more straightforward in text code.

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