Forums > MaxMSP

max newbie/making a list

January 12, 2007 | 6:31 pm

hey, i am a total and utter max newbie, i want to use the key object to make a list for example the first key pressed create a number go into box 1, second key box two etc, please help


January 12, 2007 | 8:08 pm

I’m not entirely sure I understand what you want to do but…

check out the zl object

also try pasting the following directly into your patcher window.

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 115 89 22 196617 set;
#P newex 192 60 40 196617 itoa;
#P window linecount 2;
#P message 143 118 50 196617 a b c v e f a s d f v;
#P window linecount 1;
#P newex 192 96 78 196617 prepend append;
#P newex 192 29 40 196617 key;
#P connect 4 0 2 0;
#P connect 3 0 1 0;
#P connect 0 0 3 0;
#P connect 1 0 2 0;
#P window clipboard copycount 5;


January 12, 2007 | 10:29 pm

Use the key and keyup (if you use both on the same letter it’ll allow momentary on / off, if you are using them as toggles).

Use the sprintf %c object after the key object, so you can then route letters instead of ASCII numbers. Then use the route output to generate / send your numbers.

Here’s a simple example, the rest is up to your imagination and some diligence. You can readily have all the keys on your keyboard do something (both when pressed and when released, if desired).

I generally don’t use numbers in key commands as they are also used to type into number boxes, but they can be used. However, if key focus is in a number box (if the triangle is highlighted / the box is selected), the underlying key object will temporarily not function for numbers (the focus is overriden by the number box). Letters do not have this problem.

Avoid looking for the semicolon and the comma, they are reserved for Max functionality and don’t respond well to key and keyup.

Hope this helps, C

———————

max v2;
#N vpatcher 15 55 844 447;
#P window setfont "Sans Serif" 14.;
#P window linecount 3;
#P comment 257 41 224 9109518 If number box is selected , numerical key commands are not "seen" by the key object…;
#P window setfont "Sans Serif" 20.;
#P number 328 115 67 20 0 0 0 139 0 0 0 59 159 255 222 222 222 0 0 0;
#P button 441 213 24 0;
#P button 391 213 24 0;
#P window setfont "Sans Serif" 12.;
#P window linecount 1;
#P message 434 248 34 9109516 50;
#P message 384 248 34 9109516 5;
#P window setfont "Sans Serif" 14.;
#P message 470 293 66 9109518 set;
#B color 1;
#P window setfont "Sans Serif" 18.;
#P message 280 332 470 9109522 5 50 1 2 3;
#P window setfont "Sans Serif" 12.;
#P newex 280 299 154 9109516 prepend append;
#B color 1;
#P button 342 212 24 0;
#P button 292 212 24 0;
#P button 242 212 24 0;
#P button 192 212 24 0;
#P button 142 212 24 0;
#P button 92 212 24 0;
#P button 794 219 24 1;
#P button 744 219 24 1;
#P button 694 219 24 1;
#P button 644 219 24 1;
#P button 594 219 24 1;
#P button 544 219 24 1;
#P newex 544 183 312 9109516 route q Q w W e E;
#B color 1;
#P window setfont "Sans Serif" 18.;
#P message 580 149 66 9109522 .;
#B color 1;
#P window setfont "Sans Serif" 12.;
#P newex 578 114 94 9109516 prepend set;
#B color 1;
#P newex 544 85 94 9109516 sprintf %c;
#B color 1;
#P newex 544 53 50 9109516 keyup;
#B color 1;
#P window setfont "Sans Serif" 18.;
#P number 193 298 56 18 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont "Sans Serif" 12.;
#P message 335 248 34 9109516 30;
#P message 285 248 34 9109516 3;
#P message 235 248 34 9109516 20;
#P message 185 248 34 9109516 2;
#P message 135 248 34 9109516 10;
#P message 85 248 34 9109516 1;
#P newex 85 183 424 9109516 route q Q w W e E 1 2;
#P window setfont "Sans Serif" 18.;
#P message 121 149 66 9109522 e;
#P window setfont "Sans Serif" 12.;
#P newex 119 114 94 9109516 prepend set;
#P newex 85 85 94 9109516 sprintf %c;
#P newex 85 53 50 9109516 key;
#P window setfont "Sans Serif" 14.;
#P comment 548 294 100 9109518 Clears list;
#P connect 1 0 2 0;
#P connect 2 0 5 0;
#P connect 5 0 6 0;
#P connect 5 0 24 0;
#P connect 2 0 3 0;
#P connect 3 0 4 0;
#P connect 5 1 7 0;
#P connect 5 1 25 0;
#P connect 5 2 8 0;
#P connect 5 2 26 0;
#P connect 34 0 12 0;
#P connect 33 0 12 0;
#P connect 11 0 12 0;
#P connect 10 0 12 0;
#P connect 9 0 12 0;
#P connect 8 0 12 0;
#P connect 7 0 12 0;
#P connect 6 0 12 0;
#P connect 5 3 9 0;
#P connect 5 3 27 0;
#P hidden connect 12 0 30 0;
#P connect 30 0 31 0;
#P connect 32 0 31 0;
#P connect 5 4 10 0;
#P connect 5 4 28 0;
#P connect 5 5 11 0;
#P connect 5 5 29 0;
#P connect 5 6 33 0;
#P connect 5 6 35 0;
#P connect 5 7 34 0;
#P connect 5 7 36 0;
#P connect 13 0 14 0;
#P connect 14 0 17 0;
#P connect 17 0 18 0;
#P connect 14 0 15 0;
#P connect 15 0 16 0;
#P connect 17 1 19 0;
#P connect 17 2 20 0;
#P connect 17 3 21 0;
#P connect 17 4 22 0;
#P connect 17 5 23 0;
#P pop;


January 12, 2007 | 11:49 pm

hey, thanks for all the replies, you are all very very helpful. I actually found a way to do it but i twas probably nowhere near as clever as your suggestions! As i said i am a total newbie but enjoying the learning curve.Started using max about a month ago and i am really enjoying it.


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