Forums > MaxMSP

Dynamically naming colls?

Oct 15 2012 | 6:01 pm

Anybody know a way to name colls dynamically? Obviously it’s possible to provide a name for a coll as the argument, but I can’t find a way to send a nameless coll a name on the fly. Varname doesn’t seem to have anything to do with the coll name.


Oct 15 2012 | 7:03 pm

It’s not exactly what you’re asking, but do you know the refer message?

Oct 15 2012 | 8:03 pm

Thanks for your response, Chris.

Yes, I’m familiar with the refer message. I don’t believe it forms a complete solution for what I need, however.
Refer essentially lets me refer a secondary coll to a primary named coll. I’m trying to actually supply the name of the primary coll programatically.

The coll in question is inside a bpatcher. I want the coll to be named according to one of the arguments of the bpatcher. So let’s say the bpatcher arg is "instance1". I want the coll inside this instance of the bpatcher to be named "instance1" (so that I can then refer other colls to it by the name "instance1"). I could hard code the object "coll instance1", but then it wouldn’t work for other instances of that bpatcher that supply different args (for "coll instance2", "coll instance3", etc..) So I’ve just got a generic coll object in the bpatcher… and I want to essentially send it some sort of name message… which doesn’t seem to be supported.

Then again, this could be another exciting episode of the bleeding obvious escaping me after staring at the screen too long!


Oct 15 2012 | 8:33 pm

#1 will let you provide an argument. (It’s a macro: #1 get’s replaced by your first argument at load time) Use #2, etc. for subsequent arguments

Also, be sure to check out #0, which generates a patch-local unique numerical identifier.

Oct 15 2012 | 8:34 pm

P.S. If you’re using a bunch of colls, you might look into using dict.

Oct 15 2012 | 10:33 pm

Ah. What Peter says is closer to what you want then. In this case you give an argument to bpatcher that is the coll name, e.g. myCollName. Then you place the coll like [coll #1], and assuming that myCollName is argument 1 to the bpatcher, it will be instantiated as [coll myCollName].

Max is smart about showing you #1 when unlocked, and myCollName when locked, if you’re viewing the bpatcher using Object—>New View in the contextual menu.

Oct 15 2012 | 11:43 pm

gate and forward … as the cheapest solution. i see an abstraction called "collselect".


Viewing 7 posts - 1 through 7 (of 7 total)

Forums > MaxMSP