Forums > MaxMSP

deleting some values from a zl queue?

July 16, 2009 | 6:26 am

Hi, my name is Julieta,
I haven’t used Max for too long, and I am trying to work on the logic of my program. I am a little stuck on this, and I am wondering if someone would have any suggestions…. I have five spots on the floor (numbered 0 to 4) that are read as with a status ON of Off according to the presence of a person on that spot.
I need to keep track of the spots that are ON, and also the order in which they were activated. So I want to use a zl queue to store the spots that are turning ON, and then pop them in the same order after certain events. But if a spot is turned to OFF, I want to be able to remove it from the queue. Is this possible with a zl queue?

For example, if the spots 1, 4, 0 and 3 are turned ON, I store them in this order, the queue would pop 1, then 4, but if at that point I receive a signal that spot 0 is now OFF, I need to be able to remove the 0 from the queue so that the next one popped would be 3. etc.

I was using FUNBUFF before, which worked fantastic to track which ones were on or off, but I wasn’t able to keep track of the order.

Thanks in advance for any advice on this!


July 16, 2009 | 10:35 am

hello – i would probably do this using lobjects
it has objects for this and a bunch of other useful list operations. the attached patch does what you describe using lbuild, but there are many other ways..

– Pasted Max Patch, click to expand. –

July 17, 2009 | 1:52 am

Thank you for your reply… but how do I read what you just sent?
(I am using Max 4.6)

July 17, 2009 | 7:00 am

[coll] makes this easier.

July 17, 2009 | 9:20 am

yes this patch is max5 im afraid – i might be able to put it into max 4.6 tomorrow
in the meantime, perhaps roman could post his coll solution..?(you’re right btw, the wood was in front of the trees)

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