Multiple actions in function

Started by rcarp, Mon 08/04/2024 23:08:00

Previous topic - Next topic

rcarp

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?
Code: ags
function room_FirstLoad()
{
  player.Walk(320, 262);
}
 
This works great. The room loads, the player walks to x320 y262, no worries.

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

Code: ags
  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
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?

rcarp

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.

SMF spam blocked by CleanTalk