How to send variable # arguments to an abstraction

    Feb 19 2006 | 4:19 pm
    Hello there
    Can anyone tell me how to do this? I've created some abstractions, and at the moment I have to copy the abstractions and enter the # argument into the object box. Is there a way I can trigger the box to contain a different number?

    • Feb 19 2006 | 5:09 pm
      simply add inlets for each of the [i #1] in the abstraction, then you can work with them exactly like you re used from objects.
    • Feb 19 2006 | 5:17 pm
      I've created an inlet within the abstraction, but what do i connect it to within the object, and what do i put in the message box (for example "set #1 7" or something?). I assume i can just send it a number.
      I may be sounding stupid but can't work it out! hehe
    • Feb 19 2006 | 7:01 pm
      it is a bit difficult, but only when you do it the first time.
      i forgot to tell you something important:
      you have to connect a loadbang to every [i #1] to make the whole thing work.
      here is an example abstraction.
      save that as [tobysucks], and call it up from another patcher window as [p tobysucks].
      then set an argument "303"; [p tobysucks 303].
      then change the argument to "404".
      then try 505, 606 and so on. when you have tried 253402534 your wife will call you to do the dishes.
      you will see that this works only because of the loadbang, which bangs again as soon as you set or change one argument.
      the inlet is connected to the [i] so that you can also just send data into the abstaction, this process has nothign to do with the fact that the [i] can also be set by an argument.
      just for the records, it works of course the same way with [f] or [s] arguments.
    • Feb 19 2006 | 7:10 pm
      argh, now i told you bullshit again.
      of course do NOT make a [p] - it only works when the subpatch is loaded as abstraction! ;)
    • Feb 19 2006 | 7:16 pm
      Ah, I see.
      mmm... How do you change the i (#) number though, without having to type 303 or whatever into the object/abstraction? Cheers.
    • Feb 19 2006 | 7:18 pm
      By that I don't mean the number output by the i number, I mean the actual variable number (say changing from i 303 to i 304). Rahrahrah
    • Feb 20 2006 | 2:57 am
      Can anyone help with this problem? Would be much appreciated! (Thanks for the response Roman)
      I basically need to vary the argument of an abstraction, without having to enter the number into the object box: Therefore changing the value of "#" by sending the abstraction a number.
      Thanks for any replies!
    • Feb 20 2006 | 3:39 am
      It's most likely going to involve scripting. Check out the thispatcher object and the scripting tutorial. Sprintf using the %c feature to create the # sign. (look up # using key)
      pak numberFor#Character TheNumberOfTheOutlet (e.g. 66 3) | sprintf whateverTheCommandsToMakeTheObject %c%d | thispatcher
      I use a sprintf created by scripting to create my abstractions which convert multislider lists into matrix~ coordinates. (it's generated at instantiation, but it shouldn't be that different) I've posted them before to the list, but if you want them, e-mail me and I'll send them offlist.
      Peter McCulloch
    • Feb 20 2006 | 4:21 am
    • Feb 20 2006 | 7:10 am
      > I basically need to vary the argument of an abstraction, without > having to enter the number into the object box: Therefore changing > the value of "#" by sending the abstraction a number.
      You haven't described any reason that simply using an inlet would not work for you. Add an inlet to the abstraction, massage the input as necessary, and connect it to where it needs to go. I've found very few instances where I need to change an object's properties and can't accomplish it through a message of some sort sent via a patchline.
      In those cases - which generally involve reinstantiating an object anyway, eg for a different number of in/outlets - I use scripting or javascript. See [thispatcher] or [js].
      Maybe this is a case for #0 and maybe not. I made a goofy little abstraction once to tell me the instantiation number given by a #0-argument. This is one way abstractions can report their id numbers back to their context. I refer to it as guid but you can call it whatever you want. Use this way:
      [bang] | [guid #0-id] | [print id#]
      I'm sure there are better ways. After I came up with this, my project eventually stopped using it due to improved design. Something to think about. Here's the abstraction (copy/pasted):
    • Feb 20 2006 | 1:22 pm
      > I basically need to vary the argument of an abstraction, >without having to enter the number into the object box: >Therefore changing the value of "#" by sending the abstraction >a number.
      that is not possible and i do not see what it could be good for. typing arguments into boxes is a job you do to set arguments, and not to display the current argument.
      but it should be no problem just to use numboxes to enter arguments and place the numboxes onto the object box.
    • Apr 08 2016 | 3:34 am
      This is an old topic I know but I have to give thanks to Roman for explaining how to use the # symbol within an object.
      Wasn't understanding AT ALL until I found this thread.