Possible to set gate object from JS?

    Apr 21 2013 | 8:00 pm
    Is it possible to set a gate's state from JS without targeting a number box or toggle connected to gate?
    Also, if the above is possible, is it possible to address different inlets of an object? (Not sure why I would need this now, but probably good to know).

    • Apr 22 2013 | 3:25 am
      Hi - if the scripting name of the gate is 'my_gate' then you can call:
      this.patcher.getnamed( 'my_gate' ).int( val );
      which will send the int 'val' to the gate object (i.e. open that outlet)
      don't know if you can target an inlet specifically, not something have needed to do so far
    • Apr 22 2013 | 10:16 am
      Thanks Lee, presumably .float works as I expect as well? Could you point me to the relavent documentation?
      Nice to hear someone making decent dance tracks on the forum too!
    • Apr 22 2013 | 11:41 am
      thanks for you kind words :)
      if you look at the gate documentation, float and int are treated the same..., both will select the gate outlet...
      if you pull up help in max, type in javascript into the search, then scroll to the bottom there should be a 'Javascript in Max' section - open this up and then there are a number of sections describing the js objects and what calls/properties they have. the bit relevant to this is at the bottom under the 'Maxobj methods' heading...