Forums > MaxMSP

multiple if statements??

October 10, 2010 | 1:49 pm

Hello

Very new to Max, could someone tell me what i need to do to get this if statement working. i imagine its something very simple that i’m missing

thanks

john

– Pasted Max Patch, click to expand. –

October 10, 2010 | 1:50 pm

oh, 97 and 98 are the ASCII codes of ‘a’ and ‘b’ on the keyboard. so when i press a i want it to output 31 and b to output 32


October 10, 2010 | 2:28 pm

Hello john amino,

– Pasted Max Patch, click to expand. –

my favorite way is using [sel] and [trigger] …

"or" is || ; (alt + shift + L on my macbook) ;

but anyway your statement is not correct :

– Pasted Max Patch, click to expand. –

HTH …


October 10, 2010 | 2:45 pm

ahhhhh, a select statement. thanks! that seems so obvious now.


October 10, 2010 | 3:15 pm

If you’re dealing with larger sets of numbers, you also might want to have a look at [coll].

M


October 10, 2010 | 3:23 pm

great, thanks for the help


October 10, 2010 | 9:48 pm

for lots of ASCII key characters, I run it through [sprintf %c]. this way your select statement can be [sel a b c d e] etc. instead of ASCII numbers, more intuitive.

note that non-printing characters like space, tab, enter etc. won’t print out from the sprintf, it’s only for letters/numbers/symbols. but [sel 13 9 8] will react to Enter, Tab, Backspace, for example.

yep, select is basically a multiple "if" statement, or a "switch" statement. I don’t see or use the [if] statement in Max very much, but sometimes it helps for certain things.


Viewing 7 posts - 1 through 7 (of 7 total)