Forums > MaxMSP

Abstraction detection using #1


Maa
March 23, 2011 | 5:51 pm

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. –

March 23, 2011 | 6:16 pm

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


March 23, 2011 | 6:23 pm

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



Maa
March 23, 2011 | 7:55 pm

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


March 24, 2011 | 8:09 am

but it is; it will be replaced by 0



Maa
March 24, 2011 | 11:23 pm

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. –

March 25, 2011 | 1:45 am

Is this what you want to do?

– Pasted Max Patch, click to expand. –


Maa
March 25, 2011 | 2:27 am

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. –

March 25, 2011 | 2:56 am

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. –


Maa
March 25, 2011 | 10:42 am

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


March 25, 2011 | 11:52 am

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

– Pasted Max Patch, click to expand. –


Maa
March 25, 2011 | 1:45 pm

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


March 25, 2011 | 3:19 pm

> 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. –


Maa
March 25, 2011 | 9:45 pm

Thanks I got it now


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