deleting some values from a zl queue?

Maria's icon

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!

Julieta

goodparleyandorfing's icon

hello - i would probably do this using lobjects http://arts.ucsc.edu/ems/Music/research/Lobjects.readme.html
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..

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

Maria's icon

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

Roman Thilenius's icon

[coll] makes this easier.

goodparleyandorfing's icon

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)