Forums > MaxMSP

Pushing List Items

Apr 11 2013 | 8:48 am

Hello, I hope someone here can help me. What I am trying to do is for each time a key is press, the key code for that key is added to the end of an ongoing list of pressed keys. I think I need to used something like zl join to get this to work, but I’m not having much luck yet. I have some experience with things like javascript but I’m having a hard time wrapping my mind around Max. My snippet is pasted here. Thank you!

-- Pasted Max Patch, click to expand. --

Apr 11 2013 | 9:28 am

yes, it’s possible with [zl join].

here’s a couple of ways of doing it (the difference being that the [zl] solution will remember what has been stored already even if you delete the message box, whereas the [append] solution only adds the last typed number to the list, so it will "reset" if you clear the message box).

-- Pasted Max Patch, click to expand. --

(these add the new numbers to the beginning of the list – if you want to add the numbers to the end of the list, change [append] into [prepend], or add a [zl rev] before the message box in the [zl] example)

Apr 11 2013 | 9:30 am

Here is one way with a dirty hack.
The reason of the use of the "_" is that there is that zl doesn’t handle empty lists. There are for sure other ways to do it.

-- Pasted Max Patch, click to expand. --

Apr 11 2013 | 11:35 am

Can also be done with [zl queue], if you don’t need continuous output of the list.

-- Pasted Max Patch, click to expand. --

Apr 11 2013 | 3:54 pm

Wow, you guys are fantastic. Thank you so much!

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

Forums > MaxMSP