loadbang only when abstraction made

Nov 11, 2010 at 12:57am

loadbang only when abstraction made

Sorry for the odd title, I’m not even sure what to call this.

I made an abstraction (simplified version attached) which when added to a parent patcher will create a new flonum in the parent patcher. The problem is that once the parent is saved and reloaded, another flonum is then stacked on top of the original. I am not sure how I could gate it so that the script message only goes through the first time. I thought perhaps some kind of query to see if a named object already existed, but I could not find info on if or how that’s done.

parent patch:

– Pasted Max Patch, click to expand. –

abstraction [flonum_creator]:

– Pasted Max Patch, click to expand. –

Thanks,
Eric

#53259
Nov 11, 2010 at 1:06am

change the abstraction so that it will always attempt do delete, then create the object.

#191373
Nov 11, 2010 at 12:36pm

Thanks Roman. I had thought of that as well, but there are two issues I have with it (should have mentioned them in the first post)

1) I want to make this reusable and be able to change the appearance/behavior of the flonum with the inspector for separate instances (rather than hard code it during creation)

2) I need to be able to connect each instance to different objects in a patch (rather than hard code a connection during creation as well)

The reason I am doing this is to have a decent amount of code in the [flonum_creator] abstraction with specific sends/receives and other data affecting the flonum. I basically want to add a bunch of functionality to the flonum (and other ui objects). I thought about jsui, but it is way more than I would have an idea to do with js. I also thought about using a bpatcher with all the other code inside, but then could not use the inspector to adjust appearance and behavior of the flonum. Ideally, I would like to be able to add the abstraction [flonum_creator] to a patch and have a flonum appear with a scripting name and all connections to the code in the [flonum_creator] already linked to the object, then be able to edit the flonum through the inpsector like any flonum object (and have those changes not get overwritten when loading the parent patch).

Not sure if anyone reading this is familiar with ppooll, but when the abstraction [actmaker] is added to a patch, other objects are created around it, but not recreated every time the patch is made. I’ve spent hours looking at it, but it’s so nested that I can’t make sense of it. I’ll keep trying to untangle it, but if anyone knows of any solutions or suggestions, I’d appreciate it. I apologize for the length of this post.

Thanks,
Eric

#191374
Nov 11, 2010 at 2:17pm

Give your object a name, use pattrexists to find out if it exists, only create if it doesn’t…

Stefan

#191375
Nov 11, 2010 at 2:33pm

Perfect; I had no idea about this. Thanks Stefan!

#191376

You must be logged in to reply to this topic.