Abstraction detection using #1

Mar 23, 2011 at 5:51pm

Abstraction detection using #1

I am using instance name to save file at load and close (no savebang)
so I use #1 to generate filename
But I’d like for the abstraction itself (original) to avoid having
#1 in the name and replace it with “default” for example
how to test #1 ?

– Pasted Max Patch, click to expand. –
#55768
Mar 23, 2011 at 6:16pm

not sure if i understood your question, but if you don’t give a name/argument which should be/replace #1, max sends/generate 0 instead of #1
what I do is using a [sel 0] which bangs to a “default” value/name etc

again, not sure if i understood your question. Hope it helps

kasper

#200496
Mar 23, 2011 at 6:23pm

The patcherargs object will give you a default argument if none is specified.

#200497
Mar 23, 2011 at 7:55pm

want to change the behavior of the original file
where #1 is not replace by anything

#200498
Mar 24, 2011 at 8:09am

but it is; it will be replaced by 0

#200499
Mar 24, 2011 at 11:23pm

it is not replaced by 0

Ok I made the problem even simpler

if you include the 3 blocks here in a patch and load it
the last one is set to #1
i’d like to get “default” there

– Pasted Max Patch, click to expand. –
#200500
Mar 25, 2011 at 1:45am

Is this what you want to do?

– Pasted Max Patch, click to expand. –
#200501
Mar 25, 2011 at 2:27am

No but thanks

I think you meant to use sel not split (below a corrected one)

I want the default message to be trig not for an abstraction used with no name in a patch : yes #1 is replaced by 0 in this case
but when you open the original patch where it is

– Pasted Max Patch, click to expand. –
#200502
Mar 25, 2011 at 2:56am

This one will replace the #1 with default when the patch is not an abstraction, but use the first arg if there is one assigned. It will output a zero if no arg is defined.

– Pasted Max Patch, click to expand. –
#200503
Mar 25, 2011 at 10:42am

YES, I can move on now, THANKS

in case somebody else need it
I made it faster (I’m a programmer, got to optimize)
it deal also with the no argument case

– Pasted Max Patch, click to expand. –

Maa

#200504
Mar 25, 2011 at 11:52am

You found a solution, but with patcherargs it all becomes simpler.

– Pasted Max Patch, click to expand. –
#200505
Mar 25, 2011 at 1:45pm

yep but so difficult to understand (and test)
when your not a max addict for months
and have only a so clear patcherargs help/reference
could you explain / comment please

#200506
Mar 25, 2011 at 3:19pm

> could you explain / comment please

Sure. I forgot that I found the patcherargs object a little intimidating myself when I got to know it.

– Pasted Max Patch, click to expand. –
#200507
Mar 25, 2011 at 9:45pm

Thanks I got it now

#200508

You must be logged in to reply to this topic.