Stop iteration?
Hi there,
Simple problem, but I'm rusted.
I want to get the ID of the first empty clip slot in the currently selected track.
I'm almost there but...
How do I stop the iteration of the track's clip slots' ID as soon as the first empty one is found (my [sel 0] in the patch? At the moment the things keep going on until the last clip_slot... in other words it keeps iterating.

sure it does, because you only signal that 0 is matched, which does not stop list.iter.
which actually does not matter unless you have maaaany clip slots.
If you really want to stop the process you would not iter the list, but uzi the list
and stop uzi after first zero is matched.
Hey cheers!
But how do I store e.g 20 "ID xxxx" and then bang them each one by one with [uzi] until the [uzi] is stopped?
If I store the whole list in [zl.reg] and bang it, it output the whole 20 "ID xxxx".
If I [zl.change 2] then I'm still getting the whole package sent.
(sorry that's a simple thing, but I never worked with lists that way)
Another option is to [list.slice 2] the list to take its two first items, treat them while storing the remaining ones, and if the slot is not empty, repeat.
I did not take the time to test in condition, but it should work.
Nice one TFL, works exactly as I need! Thanks a lot.
What I meant is simple, collect slots and querry one by one till first empty slot appears, there are many ways to do that....
But as you are allready having solution, no need to follow this
"collect slots and querry one by one" yes that's what I was trying to do and where I was stuck not knowing how to do.
Were you thinking about storing them in a coll and then calling them from here, or something like that?
TFL solution was perfect, but I'd love to learn about other options.
If I understand it correctly, you only want to know which is first empty clip slot
on selected track , is that correct ? or if none of clips are empty ?
in that case you can use path live_set tracks 0 clip_slots $1
and then get has_clip
(you can change track number on the fly either querying selected track,
track where device is etc... and combine that into that one message)
then you start from 0 and continue till first match says empty.
I can make a patch if you don't manage that alone, just post...
depending on what info you want to send,
collect track id & slot id, or track number and slot number that is empty ...
one could also list all tracks, and test all of them for first empty slot, just extending
to increasing track and slots numbers.
or then use coll in case you need more descriptive things, like track names

hey Source Audio thanks for offering help,
yeas I "only want to know which is first empty clip slot on selected track , is that correct ?"
But as said earlier, the little tweak made by TFL was exactly was I needed so I'm all good and is very elegant.
I was just curious in knowing more about the option you had in mind ;-)