Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: rcarp on Mon 08/04/2024 23:08:00

Title: Multiple actions in function
Post by: rcarp on Mon 08/04/2024 23:08:00
Hey guys, absolute beginner here so I'm sure there's a VERY simple answer/explanation for the following. I've been going through the tutorials etc and am starting to experiment a little, what I'd like to do is: the first time the player enters a room, they automatically walk to a specific x/y and say something. Easy, right?
function room_FirstLoad()
{
  player.Walk(320, 262);
}
 
This works great. The room loads, the player walks to x320 y262, no worries.

Code (ags) Select
  function room_FirstLoad()
{
  player.Say("some words!");
}
 
This version also works great. The room loads, the player says some words, no worries.

Code (ags) Select
  function room_FirstLoad()
{
  player.Say("some words");
  player.Say("some more words here");
}
Yet again, this works fine. The player says the first line, and then the second.

now:
Code (ags) Select
function room_FirstLoad()
{
  player.Walk(320, 262);
  player.Say("some words!");
}
This, however, does NOT work as expected. I would think the player would walk to the coords, and then say the line...however, when the player enters the room he *only* says the line, he does not walk. Did I miss something completely fundamental about having things inside a function like this?
Title: Re: Multiple actions in function
Post by: rcarp on Mon 08/04/2024 23:31:03
Figured this out...my player.Walk function needed the eBlock parameter, it now works as expected. Searching the manual more thoroughly really does work! Please feel free to delete this topic.