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.
-- Pasted Max Patch, click to expand. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 453.3ocuS1zaaCCCF9r8uBB0qYA1tYCMam1wdY.6bQQ.iBcrVkkBrXZRZQ+u O8gsSCZZwZGPOXZqWRSJ9HpGyyDKs6Im.9NbCjk8XdVVTJHj0uNSzh6kZzEC SHsssjgESR9XZOG0uFvVPas2oLqgZaGfvN7.vVnAum.tg.boi6PIqrFnVaMa aWH6Hj8AaM5CPbgOrdmfc4eHIC6ZnWDuxA0pNGCa1xfxDS+FjkMSgqAIZLV1 qoL2A15i6j0gzqXvYArlotv2iYJU8UAscJsFBoXbGYncC6JBkM.qZIvtgLK7 u8oH7IsZ5.UzJCIsaMQzTV1qpVEIkus9x7gHqsF1odfhAVMsnWN1KdRtnySf zwSY0Lu6TPP4WKRutZZAba+O42cJil33AU4QQ6VdPs3Yk0fswxJ9YmB0hfim xyClI+iyBdp3algV4draLkd16h8.08hIky36Yj4xOBYBr3ayOZqJdeXo50wR umTv7gMTplBwD+yXMb9Y7dGW7qfqSZRP7if4heGrjYURAt8+F4iL8zqGmAqU e.rdY.kyhvcd4ai0hOgosTOdlda16u2h2dhlzEoOgAF+1G4vI+Rzr9zCe+hm x+6Bbz1L -----------end_max5_patcher-----------
-- Pasted Max Patch, click to expand. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 351.3oc0TtraBCCDEcsyWgkWSQIlWB10uiJTkI1AlJG6H6AAsH92arShn7nU H.gT2LQ9Nim4lSh8tDBagcqxynynuQIjcIDRTJHPZWSXkhs4ZgOVFyn1XW7A qWSJTsEixUBDcEV2FgSRqDNkAmMCWA95D4qTttM.xX40s3kwcZEVC5guTgLY 79osxwcBlku6T4XiE4grzoSCwrISBO3o8Soya2hYcIXzJLZ0rCh103opggZD kwgxd0ABcmcZJF+rR0LTFiNOjYeRRHz69.kuxAFrf5ycPERapp9EjVns0N8B bZ3MCpICZ.E++HnjJMcT5E3A+VwwvQw3f+lF7GEMVHLKenDQaExXSOmIY2JS BbnGcb5S5OjyYRbfLMXN8ZnnkC5GCJucsKuqccGOnG7sT4QvHPvZ9QQGWyJP JUwzc7oDjU15yksd3W9pcsVheENZ3y0RYWgk32gipWrO4afAUt27 -----------end_max5_patcher-----------
change the abstraction so that it will always attempt do delete, then create the object.
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.
Give your object a name, use pattrexists to find out if it exists, only create if it doesn’t…
Perfect; I had no idea about this. Thanks Stefan!
Forums > MaxMSP