How do you reset a [value] object?

Gautzilla's icon

Hi,
I'm working with a [coll] that stores a collection of lists.
Each list starts empty, and I append values to the different lists during time.
Each time I pick a new list, I store its value in a [value] object. The issue is that, if I pick an empty list after manipulating a non-empty list, I can't find a way to reset the [value] object ; it keeps the values of the previous list.
How can I do that? The only way I found is to manually (or through script) remove each [value] object from the patcher and then create them again, but that's really clumsy..

Thanks!

Source Audio's icon

value object has no reset function.
If you really need value object, for example to access it's contents in various locations,
only way to reset is is to set it to some value out of range.
For example if you use numeric lists, feed it symbol a and append sel a at it's output.
Otherwise, uze zl.reg which can be cleared using zlclear message

Gautzilla's icon

Thanks for your answer!
I found a workaround by adding a "dummy" value at the beginning of each list (so that once I load a new one, it's not empty but contains the dummy value). Not the most elegant but it seems to work. I might consider using zl.reg tho!

Roman Thilenius's icon


zl reg wherever possible, but for objects like [v] you can use a placeholder string or number like so:

[v foo]
[route 666] (right outlet)

in my version of max this was requried for zl, too, i a regulary use it is that way for initialisation processes.

Gautzilla's icon

Thanks for the answer!

zl reg wherever possible

The main reason why a [value] object was more suitable here is that I need to access the list from different parts of my project, which can by quite complicated with anything else that I can think of, other than a [value].

Source Audio's icon

check grab object.
You can also place copies of named coll as many times as you want in your patches.

Gautzilla's icon

I forgot that [grab] existed, thanks for the hint!

Yup, I already use multiple copies of the [coll], but I access the given list only once, unpack it and store the information about it in [values] to be accessed elsewhere.

Roman Thilenius's icon

or make a custom abstraction for zl reg which already includes send/receive/initalisation process so instances of it are in sync all the time... but yes, it is a bit complicated. (and you might end up with an abstraction which requires [var] to work, haha.)