JS String to Max Message


    Oct 18 2007 | 1:53 am
    Is the attached stuff really the best way to do this? I tried sending out max messages to an automatic 0 videoplane from js but max obviously wasn't having it. However, I was also surprised to find that inserting a fromsymbol didn't solve it. I had to rig it up this way. Help is greatly appreciated. If this is the best way, just let me know.
    Thanks, Keith
    ---------save as kvm.videoplane_control.js
    inlets = 1; outlets = 1;
    var videoplane = new Array(jsarguments[1]); for (i=0;i { videoplane[i] = new Array(7); }
    function bang( ){ for (i = 1; i outlet(0, "scale " + videoplane[i][0] + " " + videoplane[i][1]); outlet(0, "position " + videoplane[i][2] + " " + videoplane[i][3]); outlet(0, "tex_offset_x " + videoplane[i][4]); outlet(0, "tex_offset_y " + videoplane[i][5]); outlet(0, "tex_scale_x " + videoplane[i][6]); outlet(0, "tex_scale_y " + videoplane[i][7]); outlet(0, "color" + " " + videoplane[i][8]); outlet(0, "texture " + videoplane[i][9]); outlet(0, "bang"); } }
    function vp(number, scale_x, scale_y, loc_x, loc_y, tex_offset_x, tex_offset_y, tex_scale_x, tex_scale_y, alpha, texture){ videoplane[number][0] = scale_x; videoplane[number][1] = scale_y; videoplane[number][2] = loc_x; videoplane[number][3] = loc_y; videoplane[number][4] = tex_offset_x; videoplane[number][5] = tex_offset_y; videoplane[number][6] = tex_scale_x; videoplane[number][7] = tex_scale_y; videoplane[number][8] = alpha; videoplane[number][9] = texture; }

    • Oct 18 2007 | 2:42 am
      On 18 oct. 07, at 10:53, keith manlove wrote:
      > outlet(0, "scale " + videoplane[i][0] + " " + videoplane[i][1]);
      You need to send an array or separate the elements with a coma because outlet() can do that:
      outlet(0, "scale", videoplane[i][0], videoplane[i][1]);
      When you use "+" with string in JavaScript it just concatenate the strings to make an unique one.
      HTH, ej
    • Oct 18 2007 | 3:04 am
      Thanks EJ; that does help; I'm not getting error messages anymore, but the videoplane still isn't responding. I really feel like I'm missing something obvious.
      Keith
      On 10/17/07, Emmanuel Jourdan wrote: > On 18 oct. 07, at 10:53, keith manlove wrote: > > > outlet(0, "scale " + videoplane[i][0] + " " + videoplane[i][1]); > > You need to send an array or separate the elements with a coma > because outlet() can do that: > > outlet(0, "scale", videoplane[i][0], videoplane[i][1]); > > When you use "+" with string in JavaScript it just concatenate the > strings to make an unique one. > > HTH, > ej > > >
    • Oct 18 2007 | 3:12 am
      On 18 oct. 07, at 12:04, keith manlove wrote:
      > Thanks EJ; that does help; I'm not getting error messages anymore, but > the videoplane still isn't responding. I really feel like I'm missing > something obvious
      Could you post a little bit more of the patch because actually it's missing the textures, the render, etc.
      ej
    • Oct 18 2007 | 3:21 am
      Nevermind. I was doing some dumb stuff with the positioning. Thanks again for your help.
      Keith
      On 10/17/07, Emmanuel Jourdan wrote: > On 18 oct. 07, at 12:04, keith manlove wrote: > > > Thanks EJ; that does help; I'm not getting error messages anymore, but > > the videoplane still isn't responding. I really feel like I'm missing > > something obvious > > Could you post a little bit more of the patch because actually it's > missing the textures, the render, etc. > > ej > >