Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: AntoPolo on Thu 07/05/2009 11:21:44

Title: move to then display message
Post by: AntoPolo on Thu 07/05/2009 11:21:44
hi im new here so thank you for all the help that im sure i will get.

ok so ive got this bit of script:

function comp_Look()
{
player.Walk(229, 162);
Display("it says .........");
}

what im confused about is it does what i want it to do but not in the order i want it to. i want the player to walk to it and then display the message, instead it displays the message and then moves to it.

what have i done wrong?
Title: Re: move to then display message
Post by: Khris on Thu 07/05/2009 11:41:08
To quote the manual:

QuoteCharacter.Walk(int x, int y, optional BlockingStyle, optional WalkWhere);

...

If blocking is eNoBlock (the default) then control returns to the script immediately, and the character will move in the background.

If blocking is eBlock then this command will wait for the character to finish moving before your script resumes.

Thus, you need to do:

function comp_Look()
{
  player.Walk(229, 162, eBlock);
  Display("it says .........");
}
Title: Re: move to then display message
Post by: AntoPolo on Thu 07/05/2009 12:25:22
thank you ;D . im sure that isnt in my manual ive looked several times  :P
Title: Re: move to then display message
Post by: Khris on Thu 07/05/2009 14:52:31
Well, it is in mine ;)
It's online, too:
http://www.adventuregamestudio.co.uk/manual/Character.Walk.htm