Connection Bug

Aug 6, 2006 at 3:34pm

Connection Bug

Hi,

Can anybody explain what exactly causes the following bug and how to prevent this from happening?

I make a js-file containing only this line:

this.patcher.newobject(“number”, 200, 260, 35, 9);

..and then I connect another object to this one.

I then save the file, re-open it, and discover that the connection-cord has been replaced…

This is on a windowsXP system with max 4.5.5

#27055
Aug 13, 2006 at 8:47am

Okay, here’s another one:

I create a js-object containing only this line:

unpack=this.patcher.newdefault(272,90,”unpack”, “0.”, “0.”, “0.”);

I save it, so an unpack-object is made. I then test it and see that this unpack object just won’t work. It doesn’t generate any output upon receiving a list.

But if I retype (part of) this unpack-object, it suddenly starts behaving the way it should. The one question arising from all this is “Why?!?”

Is it just me or has Max gone crazy?

#81494
Aug 13, 2006 at 9:43am

> I create a js-object containing only this line:
>
> unpack=this.patcher.newdefault(272,90,”unpack”, “0.”, “0.”, “0.”);
>
> I save it, so an unpack-object is made. I then test it and see that
> this unpack object just won’t work. It doesn’t generate any output
> upon receiving a list.

it probably does output a list, if you send it a list of symbols,
cause that’s the way you formatted the unpack object.
for floating-point arguments try:

this.patcher.newdefault(272,90,”unpack”, “f”, “f”, “f”);

also, i guess you should better put your line inside a function, and
call that to execute it.

vol.

#81495
Aug 13, 2006 at 12:11pm

Hah!

Great, it works like a charm now!

Thanks alot

…even though this connection-thing (described in the first message) is still bugging me.

#81496
Aug 13, 2006 at 12:44pm

> …even though this connection-thing (described in the first
> message) is still bugging me.

as i said, it’s _not_ recommended to have a scripting command in the
global code of your js file.
see “JavascriptInMax.pdf” p. 12:
“… what not to do: refer to your object’s patcher”

stick it in a function definition and call it _once_. make your
connection and save the patch. that should work.

volker.

#81497

You must be logged in to reply to this topic.