getting unique instance i.d. val in bpatcher and abstraction

phiol's icon

Hi all,

When using poly~, you can obtain a unique voice instance i.d. using thispoly~.

Now, how could I obtain a unique i.d val per instance , when using abstractions and or bpatcher.

I know that when using scripting names on objects, say (scripting name = dog) . well

the object name will autoincrement itself like so (dog[0]) , everytime you duplicate it within the same patcher. How could I fetch that name ? I tried with pattrstorage and autopattr but no dice.

Also , the problem is that bpatcher and abstractions will not increment it's name because each instance is a different patcher.

Anyways, how could I have the equivalence of thispoly <-voice i.d. but with bpatchers&abstractions

thanks you very much

phiol

phiol's icon

found something here

https://cycling74.com/forums/get-scripting-name-heirarchy-of-nested-bpatchers/

works for now but was wondering if there was another way.

thanks

phiol's icon

mmm. shoot

don't work with abstractions.

Please consider having this built-in for max 8 , please

LSka's icon

the '#0' message gets the abstraction's unique id.

(And from quick testing it seems to assign them in right-to-left order...see attached patches)

AbstractionTest.zip
application/zip 3.25 KB

phiol's icon

thanks for the suggestion lska,

yup I knew abou thte #0_name but the problem is that it creates a unique name each time you open the patch. I wan't a fix number like thispoly and the above js solution.

thx

phiol

LSka's icon

this seems to work:

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

LSka's icon

and the TestAbstraction:

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

phiol's icon

autonaming_test.zip
application/zip 4.29 KB

Thanks again,

But your example generate the values. what I want is to have it done automatically.

In attachement is how I did with bpatcher

phiol's icon

Wait, it work perfectly fine with abstractions. I'm obviously a total noob with js :-)

what would the best place to get a list of all js functions max accepts

02autonaming_test.zip
application/zip 6.80 KB

I got this to start reading on:

https://docs.cycling74.com/max7/vignettes/javascriptinmax

https://docs.cycling74.com/max7/vignettes/javascript_usage_topic

http://max-javascript-reference.tim-schenk.de/#gsc.tab=0

anything else I'm missing ?

thanks

phiol