Newbie Question: How do you debug Javascript in MaxMSP?

Mar 25, 2011 at 2:15pm

Newbie Question: How do you debug Javascript in MaxMSP?

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! :)

#55812
Mar 25, 2011 at 8:38pm

what part isn’t working? I generally make a small script that illustrates that I’m doing it right, then expand it from there.

#200666
Mar 26, 2011 at 7:27am

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)
{
post(message);
}
}

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.

a

#200667
Mar 26, 2011 at 3:33pm

Hello,

i only use minimalist debug instruction (even with C / Xcode) like post ("!");
… maybe as i learn to code by myself so it took years to understand how to use debuggers … actually i never heard about debugger tools with javascript and maxMSP …

#200668

You must be logged in to reply to this topic.