bad arguments for message "int"

    Jul 08 2013 | 1:47 pm
    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 } };

    • Jul 09 2013 | 9:06 am
      Hi 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 | 3:04 pm
      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.