javascript datatype problem

Feb 25, 2006 at 12:25am

javascript datatype problem

hello all,

Having a problem with js. I’ve got a function that outputs via:

outlet(3, “max ” + (start+length) );

now the idea is to have outlet 3 of the js object go to a max num object and set the “max” value that num object can go up to. I get?:

error: number: doesn’t understand “max 3″

Any ideas of how to get around this?

#24604
Feb 25, 2006 at 2:59am

Moving this thread to javascript…

w

#71440
Mar 1, 2006 at 6:33pm

i think you need to send it
outlet(3, “max “, (start+length) );
instead. I think using the +, it is output as a symbol? the above format will make it a list that number will understand.

#71441
Mar 2, 2006 at 5:20pm

Thanks for the suggestion. But I still get the same error. It almost seems that strings that come out of the js object are not reconized by the num object. Anyone else? Heres the example

max v2;
#N vpatcher 15 55 615 455;
#P window setfont “Sans Serif” 9.;
#P number 155 179 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 114 180 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 103 94 42 9109513 franz $1;
#P number 98 47 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 114 130 51 9109513 js noset.js;
#P connect 1 0 2 0;
#P connect 2 0 0 0;
#P connect 0 0 3 0;
#P connect 0 1 4 0;
#P pop;

And the js code noset.js:

inlets =1;
outlets = 2;

function franz(b){
outlet(0, “set ” + b);
outlet(1, “set “, b);
}

#71442
Mar 2, 2006 at 6:05pm

This works for outlet 1:

autowatch = 1;

inlets = 1;
outlets = 2;

function franz(b) {
outlet(0, “set ” + b);
outlet(1, “set”, b);
}

Am 02.03.2006 um 18:20 Uhr schrieb Tyler Nitsch:
> inlets =1;
> outlets = 2;
>
> function franz(b){
> outlet(0, “set ” + b);
> outlet(1, “set “, b);
> }

#71443
Mar 3, 2006 at 7:02am

Hello,

Looks like this may be a Windows bug. I can get it to work on a Mac but not my PC. Anythoughts?

#71444
Mar 3, 2006 at 8:48am

To make it clearer: let’s say b is 666, if you use

outlet(0, “set ” + b);

The js object will output the message

“set 666″

on outlet 0. This is different from

set 666

because the first message is a symbol, the second message is a list made of a symbol “set” and the integer 666.

In order to do what you want you have to use

outlet(0, “set”, b);

This will work fine on Windows too.

Note, no space after “set”. Because “set ” (with a space) will output the message

“set ” 666

which is made by the symbol “set ” which is different from “set” (for example it will not be detected by [route set]) and the integer 666.

Maurizio.

#71445

You must be logged in to reply to this topic.