Forums > Javascript

javascript datatype problem

February 25, 2006 | 12:25 am

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?


February 25, 2006 | 2:59 am

Moving this thread to javascript…

w


March 1, 2006 | 6:33 pm

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.


March 2, 2006 | 5:20 pm

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);
}


March 2, 2006 | 6:05 pm

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);
> }


March 3, 2006 | 7:02 am

Hello,

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


March 3, 2006 | 8:48 am

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.


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