Newbie Question: How do you debug Javascript in MaxMSP?

    Mar 25 2011 | 2:15 pm
    I have tried searching for this for no avail. I have writing javascript to drive dynamic creation of MaxMSP objects, and I haven't figured out how to debug the javascript running in MaxMSP. I need your awesome help! :)

    • Mar 25 2011 | 8:38 pm
      what part isn't working? I generally make a small script that illustrates that I'm doing it right, then expand it from there.
    • Mar 26 2011 | 7:27 am
      I use post() statements to print out my scripts progress to the Max window....if things aren't working, you can see how far the script has progressed before you run into a problem.
      One issue with this method: if the error is in a nested function, it won't print out as expected. It is easy enough to create a debug function that can easily be turned off when your not using it:
      var debug = 1;
      function debug(message)
      if(var debug == 1)
      and then call that function just like you would a post statement:
      debug('got to this point in the script');
      Of course this only works with strings. You'd have to build something more elegant to deal with mixed messages(i.e. arrays).
      Hope this helps.