Forums > Javascript

bad arguments for message "int"

Jul 08 2013 | 6:47 am

I’m trying to update a numbox via JS. When I run the code, it returns an error "bad arguments for message "int" ."

What am I doing wrong here ?

var p = this.patcher;
var MODE = 0
var PROGRAM = 1;

function Preset(t) {
if (!MODE) { // if MODE is 0′
p.getnamed(‘#1PerfNum’).message(‘int’, PROGRAM); // #1PerfNum is the script name of a numbox
} else { // if MODE is 1
p.getnamed(‘#1PresetNum’).message(‘int’, PROGRAM); // #1PresetNum is the script name of a numbox

Jul 09 2013 | 2:06 am

you need to be sure that your "t" argument is not a "float" or "list" where its first element is a "string" (symbol) .

Jul 09 2013 | 8:04 am

Thanks KrisW.

I attempted to use function Preset(PROGRAM) instead of Preset(t) because the type for the global variable PROGRAM is int, but that didn’t work either.

How would I coerce these types to be what’s needed for the Max objects ? I’ll be researching, but it has historically taken me down rabbit holes trying to find this information.

Viewing 3 posts - 1 through 3 (of 3 total)

Forums > Javascript