Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: freshpaint on Mon 16/02/2009 21:05:59

Title: Small Bug in dialogs 3.12.81 (latest)
Post by: freshpaint on Mon 16/02/2009 21:05:59
This is a fragment of one of the options in my dialog dDuo:


@4
DUO: I really need to get out of here before dark.  I need to get to a meeting at the Hungry Boar.
  if (dKyle.HasOptionBeenChosen(1) == true ||
  dKyle.HasOptionBeenChosen(2)) {
    player.Say("The Hungry Boar? I'm going there with my friend Kyle tonight.");
    player.Say("He gave me a flyer for it.");
    cDuo.Say("Do you trust him?");
    confirm_action = dYesNoMaybe.DisplayOptions();
    if (confirm_action == 3) return;
    else {
      ...[lines of code]...
    }
  }
return
@5
stop


dialog YesNoMaybe is just what it sounds like, and it returns "confirm_action" correctly.  However, the statement "if (confirm_action == 3)" always returns to an unrelated dialog in slot 0.  If options 1 and 2 are chosen and it drops thru to the dialog system return, all is fine.

So I guess it's mixing up the dialog version of the return statement and the scripting version.  I can work around this, but thought you should know.  FYI, "confirm_action" is global, defined in globalscript, imported in the header.
Title: Re: Small Bug in dialogs 3.12.81 (latest)
Post by: Pumaman on Mon 16/02/2009 22:43:23
You shouldn't use the standard script "return" command like that within a dialog script. You need to use one of the special tokens:

return RUN_DIALOG_GOTO_PREVIOUS;
or
return RUN_DIALOG_RETURN;
or
return RUN_DIALOG_STOP_DIALOG;

depending on what you want it to do.
Title: Re: Small Bug in dialogs 3.12.81 (latest) (SOLVED)
Post by: freshpaint on Tue 17/02/2009 01:59:37
Thanks. It works now. I missed this in the help file.