—unique id in subpatch
i am aware that putting —before certain object creates unique ids when loaded, but i just tried this using a buffer object inside a subpatch (naming —test) but when i created a copy of that subpatch the id was the same.
is there a way round solving this? so if i have a subpatch containing such objects like buffers and i want mutiple versions of that subpatch within a patch that ids get created the same way?
— works for unique s/r ids -and maybe other objects – in M4L. If you have an *abstraction* (not subpatcher) with an object with id of #0test, (as opposed to —test) each instance will have a unique number when instantiated (ie 1000test)
ok i’ll give that a go. i am trying to build a looper, with several instances of one looper within the whole patch, and i want to record into each of the individually, but i dont want to create several versions on the same patch and go in and rename all the buffers accordingly. with this method work for me?
I also built a patch using [buffer~] with the — trick in M4L and it worked. I had also tried the #0 trick with no success. So it only works within abstractions ?
it is very simple.
in Max (both Max and M4L), the #0 notation creates a unique id for that abstraction only, with complete depth (but only for that abstraction). so, if you made an abstraction called "hello" in your search path, and in that abstraction there was a buffer~ called [buffer~ #0_sillysilly 1000 1], and you then instantiated that "hello" abstraction in your main patch ten times, you would have ten completely different buffers with unique four-digit numbers before all their names. each individual buffer would be able to communicate only inside the instantiated abstraction with any similarly refering #0_sillysilly objects, never interfering with any of the other abstractions in your main patch.
in M4L (ONLY in M4L), the — notation makes something unique but to the ENTIRE device, regardless of whether or not the notation is inside an abstraction or subpatch or whatever. so, if in your "hello" abstraction you had a buffer [buffer~ —sillysilly 1000 1], it would refer to the SAME buffer in all ten of your instantiated abstractions, and any other level / subpatch etc of your entire device. so writing to one —sillysilly would be writing to ALL —sillysilly ‘s.
remember, you can always pass #0 and — notations into abstractions as #1 etc arguments, to temporarily get round complex sharing scenarios. and you can easily send the #0 result out of an abstraction for other id-ing, for example a [loadmess #0] sent out an outlet.
success chaps! thanks.
Nedrush, just to be clear: the #0 argument should not have a space after it (ie #0test or #0_test etc. is ok) otherwise the object will interpert #0 and test as two seperate arguments, as appears to be the case in your image. Not sure if that’s what you actually intended…
i’ll bare that in mind. many thanks.
Forums > MaxMSP