Forums > MaxMSP

multiple if statements??

Oct 10 2010 | 1:49 pm


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



— Pasted Max Patch, click to expand. —
Oct 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

Oct 10 2010 | 2:45 pm

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

Oct 10 2010 | 3:15 pm

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


Oct 10 2010 | 3:23 pm

great, thanks for the help

Oct 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 6 posts - 1 through 6 (of 6 total)

Forums > MaxMSP