Forums > Javascript

setting up inlets and outlets

May 18, 2008 | 3:42 pm

Hi all,

This is a most fundamental of problems and searching the forum for inlets or outlets gives a few unrelated replies.

Max does not like the way I have declared the following because it stubbornly keeps only one inlet and one outlet. Please help.

// some global statements
inlets = 2;
outlets = 2;

function msg_ing(a) {
// some local statements
outlet(1, a); // js: bad outlet index 1
}

Thank you.


May 18, 2008 | 5:57 pm

On 18 mai 08, at 17:42, Glen wrote:

> Hi all,
>
> This is a most fundamental of problems and searching the forum for
> inlets or outlets gives a few unrelated replies.
>
> Max does not like the way I have declared the following because it
> stubbornly keeps only one inlet and one outlet. Please help.
>
> // some global statements
> inlets = 2;
> outlets = 2;
>
> function msg_ing(a) {
> // some local statements
> outlet(1, a); // js: bad outlet index 1
> }

That should work if you write "js yourjsfile.js" in a box, it should
appear with 2 inlets and 2 outlets. How are you instantiating your js
object?

ej


May 19, 2008 | 9:48 am

Yeah, I seem to have path problems. When I loaded MAX at the start of the day, it could not identify the script at all.

When I make a parent patcher referencing my script, that script is missing. However, if I close and reload the parent patcher, my script appears OK.

Could someone please explain because I have an open-book exam in a couple of hours and speeeeeeed is important :(


May 19, 2008 | 9:59 am

Also, *ahem*, if someone could tell me very quickly how to separate values from each inlet I would be super-grateful.

Sorry for not taking time to look this up. I’m swept off my feet with Jitter revision, lol..


May 19, 2008 | 10:02 am

On 19 mai 08, at 11:48, Glen wrote:

>
> Yeah, I seem to have path problems. When I loaded MAX at the start
> of the day, it could not identify the script at all.
>
> When I make a parent patcher referencing my script, that script is
> missing. However, if I close and reload the parent patcher, my
> script appears OK.
>
> Could someone please explain because I have an open-book exam in a
> couple of hours and speeeeeeed is important :(

The simple (quick and dirty) solution is to save the script in the
same folder as your main patch:

MyFolder:
./mypatch.pat (maxpat if it’s Max 5)
./myabstraction.pat
./myimage.jpeg
./myjsfile.js

Then you can just name your [js myjsfile.js] and it will find it,
because the folder containing the main patch is always added
(temporarily) to the search path.

ej


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