Author Topic: Syntax: setMotion  (Read 12105 times)

0 Members and 1 Guest are viewing this topic.

Offline JRedant

Syntax: setMotion
« on: February 28, 2012, 11:22:07 PM »
I'd like if there was a book or PDF that has the syntax available, instead of having to scratch around for it.

So what is the syntax for setMotion?

So far, in the tutorials, I see:

setMotion(Follow gEgo 15)

and

setMotion(MoveTo 180 150 RoomScript)

What I want to do is have an actor avoid the gEgo.



Offline MusicallyInspired

Re: Syntax: setMotion
« Reply #1 on: February 29, 2012, 02:03:15 AM »
Heh, we'd all like some solid documentation on the syntax but none exists. All we have is the SCI Studio help file and the limited tutorials that Brian made, some others that troflip made, and still others that we've all pitched in on the SCI Programming Wiki by fooling around and experimenting.

There is an Avoid script, but I think it's unfinished. I can't remember.
Brass Lantern Prop Competition

Offline Cloudee1

Re: Syntax: setMotion
« Reply #2 on: February 29, 2012, 11:28:39 AM »
There is an avoid script in the companion template but not in the studio template. You would need to add it to your game if you started with the studio template which I'm pretty sure you did. Once it has been compiled as part of the resource.map you will need to include it in the use script section at the top. I don't remember the exact sysntax for it but I think there is a post around here that tells how, or maybe  the companion help file, but somewhere.
Halloween Competition Brass Lantern Prop Competition Groundhog Day Competition

Offline JRedant

Re: Syntax: setMotion
« Reply #3 on: February 29, 2012, 04:28:03 PM »
Maybe we should need to start taking down a SCI syntax of what we know, and add to it as we go along? That would be a nice resource to have.

Edit: Cloudee, where would the Avoid script likely be? wander.sc, follow.sc, or Cycle.sc? I could just copy over the script resources from Companion. Worst case, I could copy all of them over from Companion, minus the rooms.
« Last Edit: February 29, 2012, 04:33:20 PM by JRedant »

Offline gumby

Re: Syntax: setMotion
« Reply #4 on: February 29, 2012, 09:07:15 PM »
You must have simply overlooked it.  It's the Avoid.sc file in the SCI Companion template folder.

In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition

Offline JRedant

Re: Syntax: setMotion
« Reply #5 on: February 29, 2012, 09:16:55 PM »
Oh thank Christ! I could just copy the avoid.sc over, and that would be it? Are there other linking files, or header files I would need to replace as well? Of is it just avoid.sc?

Offline Cloudee1

Re: Syntax: setMotion
« Reply #6 on: February 29, 2012, 11:01:14 PM »
In whichever room you plan to use the avoid, up at the top of the script, where all of the (use "scriptname") stuff is, you need to include a statement to use the avoid script.
Halloween Competition Brass Lantern Prop Competition Groundhog Day Competition

Offline troflip

Re: Syntax: setMotion
« Reply #7 on: April 17, 2012, 02:41:21 PM »
I'd like if there was a book or PDF that has the syntax available, instead of having to scratch around for it.

So what is the syntax for setMotion?

So far, in the tutorials, I see:

setMotion(Follow gEgo 15)

and

setMotion(MoveTo 180 150 RoomScript)

What I want to do is have an actor avoid the gEgo.

Just popping by and I saw this. setMotion doesn't have an explicit syntax other than the first parameter (which is the Motion class name).

The subsequent parameters are specific to the motion. setMotion just forwards them on through to a function on the Motion instance (I think maybe it's the init function?). So you need to find out what the parameters are for that function. The best way is to look at the source code.

For example, Follow seems to take a target and a distance. MoveTo takes an x and y, and a script to cue when its done.

I think the Avoid script is something different. It's not a Motion. It's a basic path-finding script that make the actor go around objects or blocked areas on its way to a destination.

It doesn't make one actor run away from another. I suspect you'd have to write your own script for that.
Check out my website: http://icefallgames.com
Groundhog Day Competition


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.042 seconds with 18 queries.