Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: barefoot on Mon 20/06/2011 10:11:51

Title: If else in dialog options for return and stop
Post by: barefoot on Mon 20/06/2011 10:11:51
Hi

I have a dialog with an if else.. if the condition is true then the dialog closes and returns to game as normal if it is not it then the dialog stays open.

Have tried StopDialog (); in the dialog but still shows.

barefoot

Title: Re: If else in dialog options for return and stop
Post by: monkey0506 on Mon 20/06/2011 10:36:03
It's kind of an obscure thing to find in the manual, but:

Quote from: Conversations (http://www.adventuregamestudio.co.uk/manual/Conversations.htm)If you want to conditionally break out of the dialog script, the special tokens RUN_DIALOG_GOTO_PREVIOUS, RUN_DIALOG_RETURN and RUN_DIALOG_STOP_DIALOG are available which you can return from inside a script block. For example:


@1
ego: "Hello. How are you?"
narrator: The man looks you in the eye.
 if (player.HasInventory(iKey)) {
   player.Say("Actually, I'd better go.");
   return RUN_DIALOG_STOP_DIALOG;
 }
otherman: "Here's a key for you."
return

Title: Re: If else in dialog options for return and stop
Post by: barefoot on Mon 20/06/2011 11:08:48
Cheers Monkey

I'll give that a whirl

:=

barefoot