multiple if statements??

john amino's icon

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

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

john amino's icon

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

john amino's icon

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

mattyo's icon

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

M

john amino's icon

great, thanks for the help

seejayjames's icon

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.