How to refer to a named object wihout knowing in which subpatcher it is?


    Sep 05 2008 | 11:42 am
    I want to fill a coll using a script and the .message method.
    It functions as long as the referred coll is in the same subpatcher
    as the js object. As I want to access the coll's data with several js
    objects in several subpatchers I put an instance of my coll in each
    subpatcher and give a different scripting name to each instance.
    As I would prefer not to give a different scripting name for each
    instance of my coll I wonder whether it is possible to refer to a
    coll which is not in the same subpatcher as the js object and without
    knowing its place wihin the patcher+subpatchers architecture?
    Thank you in advance.
    Roald Baudoux

    • Sep 05 2008 | 12:23 pm
    • Sep 07 2008 | 9:10 pm
      On 7 sept. 08, at 22:36, Roald Baudoux wrote:
      > Thanks for the code but it appears a little bit obscure to me.
      >
      > If I undestand it correctly I need to call the iterationmethod
      > function first then the mess function.
      >
      > However, how do I get the MyObj variable? If I try to define it with
      > var MyObj = new Maxobj and then call the iterationmethod function it
      > doesn't work.
      MyObj is the MaxObject passed as argument to the iterative function by
      the applydeep method. Here's a tested version with more comments which
      works fine. Let me know if that's not clear enough.
      Best,
      ej
      var theFirstCollIWasLookingFor; // variable which stores the "address"
      to your coll object
      function findthecoll()
      {
      this.patcher.applydeep(iterationmethod); // iterate through the
      objects (recursively, in supbatchers too)
      }
      findthecoll.local = 1;
      function iterationmethod(MyObj) // the iteration method (triggered by
      findthecoll)
      {
      if (MyObj.maxclass == "coll" && MyObj.varname == "toto") { // if
      the object is a coll, and it have "toto" as scripting name
      theFirstCollIWasLookingFor = MyObj; // store a reference
      to your MaxObject in theFirstCollIWasLookingFor variable
      return false; // get out, cause now you have one.
      }
      return true; // this is required to continue the iteration
      }
      iterationmethod.local = 1;
      function anything() // when you send any message to the object, it
      will forward it to the coll object
      {
      var tmp = arrayfromargs(messagename, arguments);
      if (theFirstCollIWasLookingFor != undefined) { // if the variable
      is not empty it it means that we already have one coll found
      theFirstCollIWasLookingFor.message(tmp);
      } else { // no coll found yet, so we need to find it
      findthecoll(); // finding the coll object
      mess(tmp); // send the message to the found call
      }
      }
    • Sep 26 2013 | 9:53 pm
      What do the blank replies mean?
    • Sep 27 2013 | 12:32 am
      they are lost, faded away by the rips of times
    • Sep 27 2013 | 12:45 am
      that is when the google terrorism suspicion detection deletes a post from beeing too radical.