(should be a newbie question) basic scripting… creating a message box?

May 26, 2007 at 3:14am

(should be a newbie question) basic scripting… creating a message box?

Okay, this should be a newbie question (and it kind of is, because I’ve
never bothered to get into scripting before.)
How do I create an instance (or multiple instances) of the Message Box
object via scripting?
I keep creating bogus “message box” object when I try. I know this is a
pretty simple request, but it’s driving me nuts…
thanks in advance


arliss renwick
http://www.myspace.com/radiopellucid
http://www.flickr.com/photos/east_asia_photo_gallery/

http://picasaweb.google.com/maxmsp/KoreaKoreaKoReverendAlGreen

#32104
May 26, 2007 at 3:52am

Here’s a pretty surefire way to get scripted object creation working:

1. Create a patch with the object you want to create.
2. Save the patch then open it as text
3. Find the line that defines the object in question, like a message box that says hello:
#P message 167 91 31 196617 hello;
4. Strip off the #P at the beginning and the ; at the end. That’s your object creation string

If you want to use a thispatcher object, you need to prepend the object creation string with a name for the object you are creating. So you can send this to thispatcher:
script new msgname message 167 91 31 196617 hello

Or do this inside a js script:
var helloMessage = patcher.newobject(“message”, 167, 91, 31, 196617, “hello”);
helloMessage.varname = “msgname”;

For the js, naming the object is optional if you just want to use the variable reference returned by patcher.newobject().

The first two numbers are the x and y coordinates, so change them as needed.

There is also a way to create objects using newdefault, but that seems a lot more trial and error to find the right arguments. I just spent a few minutes and couldn’t get it working with message boxes.

#105107
May 26, 2007 at 4:19am

UR my hero

On 5/26/07, Adam Murray wrote:
>
>
> Here’s a pretty surefire way to get scripted object creation working:
>
> 1. Create a patch with the object you want to create.
> 2. Save the patch then open it as text
> 3. Find the line that defines the object in question, like a message box
> that says hello:
> #P message 167 91 31 196617 hello;
> 4. Strip off the #P at the beginning and the ; at the end. That’s your
> object creation string
>
> If you want to use a thispatcher object, you need to prepend the object
> creation string with a name for the object you are creating. So you can send
> this to thispatcher:
> script new msgname message 167 91 31 196617 hello
>
> Or do this inside a js script:
> var helloMessage = patcher.newobject(“message”, 167, 91, 31, 196617,
> “hello”);
> helloMessage.varname = “msgname”;
>
> For the js, naming the object is optional if you just want to use the
> variable reference returned by patcher.newobject().
>
> The first two numbers are the x and y coordinates, so change them as
> needed.
>
> There is also a way to create objects using newdefault, but that seems a
> lot more trial and error to find the right arguments. I just spent a few
> minutes and couldn’t get it working with message boxes.
>
>


arliss renwick
http://www.myspace.com/radiopellucid
http://www.flickr.com/photos/east_asia_photo_gallery/

http://picasaweb.google.com/maxmsp/KoreaKoreaKoReverendAlGreen

#105108

You must be logged in to reply to this topic.