optional argument in abstraction #1 etc.

    Jun 24 2011 | 1:18 am
    is it possible to have an optional argument like #1 in an abstraction but have a default value, if the the argument is missing after the abstraction name. I tried my having default values inside the abstraction but if the value for #1 is missing I get 0, which overwrites my internal default value. Any workaround?
    thanks and all the best,

    • Jun 24 2011 | 1:32 am
      lodbang - "7" - [int #1]
    • Jun 24 2011 | 2:30 am
      [patcherargs] is your friend here, I think.
    • Jun 24 2011 | 3:41 am
      Hi Roman, I don't understand. If I use a loadbang, then my default number, then the object int with arg #1 I never get my #1 number, if I use the argument in the abstraction. What did I do wrong?
    • Jun 24 2011 | 3:43 am
      Chris, also [patcherargs] doesn't seem to help me. At least I don't know how.
    • Jun 24 2011 | 4:09 am
      Hi Frank,
      I think this may be your solution:
      ---save as "mother patch" or similar, next to the following file somewhere:
      ---save as 'patcherargs_ex.maxpat'
    • Jun 24 2011 | 4:11 am
      oh, and here is what (i think) roman was mentioning:
      ...note that this will not work if you supply an argument of zero, which is why the patcherargs methodology may be more suitable in many cases.
    • Jun 24 2011 | 4:15 am
      Maybe I try to clarify my question: I have an abstraction [my-abstraction] inside I have a loadbang triggered #1 message to let's say a [+ 50] object. When I don't use an argument in my abstraction like above I want the [*] opject to use 50. But if I use an argument in my abstraction like [my-abstraction 87], the [+] object should get "87" in it's right inlet. If I do [loadmess #1] connected to the right inlet, it will send "0" to the inlet and overwrite the "50"
      how do I do that?
      Actually here is a patch which hopefully explains my problem.
      The Abstraction "my-abstraction.maxpat":
      The patcher, using the abstraction
    • Jun 24 2011 | 4:24 am
      Thanks jeff, but unfortunately I want to be able to use "0" as an argument, which wouldn't work this way.
      best, frank
    • Jun 24 2011 | 4:57 am
      Here's your abstraction using patcherargs:
    • Jun 24 2011 | 5:06 am
      jeff, the patcherargs solution works perfect.
      problem solved!
      thanks a lot