Please login or register.

Login with username, password and session length
Advanced search  

News:

Forum rules - please read before posting, it can save you a lot of time.

Author Topic: Problems with GoTo  (Read 4452 times)

0 Members and 1 Guest are viewing this topic.

superman95

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 5
    • View Profile
Problems with GoTo
« on: September 17, 2005, 05:45:41 AM »

So, I've been frustrated with AGS....It's scripting leaves alot to be desired.  So, I downloaded WME and have been working through the tutorial.  I got to the script, and followed the tutorial to the letter, but it didn't work.

Here's the part i'm having trouble with:
Quote
The following fragment of code will be copied to the clipboard:

actor.GoTo(544, 638);
actor.TurnTo(DI_UPRIGHT);

That's fine, but when the script executes, she walks to the top right corner of the room, and not in front of the desk.  However, I can put in same coordinates in the SceneEdit and she walks to the right location.

It looks like a bug to me, which is a little discouraging it.  I've used it for 3 hrs, and i've already found an issue.  I hope I'm wrong.  Any insights would be great.
 
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: WME 1.5
« Reply #1 on: September 17, 2005, 08:47:19 AM »

It looks like a bug to me, which is a little discouraging it.  I've used it for 3 hrs, and i've already found an issue.  I hope I'm wrong.  Any insights would be great.
Where exactly did you put this code? Is your scene layout correct, as described in the tutorial? Is your scene in 800x600? I just tried it in the WME demo scene and it works ok.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

superman95

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 5
    • View Profile
Re: WME 1.5
« Reply #2 on: September 17, 2005, 05:09:09 PM »

Whenever it created the script it added a commented section that had the movetoobject function.  I uncommented and added the code there.
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: WME 1.5
« Reply #3 on: September 17, 2005, 05:38:04 PM »

Whenever it created the script it added a commented section that had the movetoobject function.  I uncommented and added the code there.
The GoToObject function in the script template is now obsolete, because you can set the WalkTo point directly in SceneEdit. The commented-out function is never called so even if you uncommented it and changed it, it had no effect and the game was using the WalkTo setting. And since the WalkTo setting wasn't set, the actor was walking to some default location.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

superman95

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 5
    • View Profile
Re: WME 1.5
« Reply #4 on: September 17, 2005, 06:04:05 PM »

Fair enough.  But you should update the tutorial.  There's a large section in step 7 of the tutorial that references this function and how to update the coordinates. 

Quote
This piece of code tells the engine to call the “GoToObject” function and then make the actor to say “Blah”. The GoToObject function has been pre-generated for your convenience and its definition is:

function GoToObject()
{
  actor.GoTo(200, 200);
  actor.TurnTo(DI_UP);
}
 
This function does the following: the actor walks to the 200,200 coordinate within the scene and then he turns “up” (to the north).

We will modify this script to achieve a following behavior: When the user uses a “Look At” icon on the desk, the actor will walk to the desk, turn to face it and then he will say “It’s a sturdy looking desk”.

....


Now we need to change the GoToObject function so that the actor will walk to the correct position in the scene. But how do we get the correct position? Well, the easiest way is to use the actor placement tool again (it’s described in step 6 of this tutorial). Return back to the SceneEdit and close the script dialog (by clicking OK). Press the “Place actor” and select the “molly.actor” file. Now setup the actor to the position where you want him to walk when looking at the desk (remember: you can move the actor by moving your mouse, you can change his direction by pressing the right mouse button and you finally anchor the actor in place by pressing the left mouse button).

OK, we’ve got the actor in place but how do we get his position to the script? Use the “Actor->Copy actor placement” function or press the Ctrl+C hotkey.

The following fragment of code will be copied to the clipboard:

actor.GoTo(544, 638);
actor.TurnTo(DI_UPRIGHT);
 
This code mimics the actor’s placement we just set in SceneEdit. All we have to do now is to paste this code to the GoToObject function in our “desk.scene” script. The function now looks like this:

function GoToObject()
{
  actor.GoTo(544, 638);
  actor.TurnTo(DI_UPRIGHT);
}


Logged
 

Page created in 0.036 seconds with 20 queries.