bad arguments for message "int"

Jul 8, 2013 at 6:47am

bad arguments for message "int"

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) {
PROGRAM = 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
}
};

#255225
Jul 9, 2013 at 2:06am

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

#255351
Jul 9, 2013 at 8:04am

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.

#255420

You must be logged in to reply to this topic.