Small Bug in dialogs 3.12.81 (latest)

Started by freshpaint, Mon 16/02/2009 21:05:59

Previous topic - Next topic

freshpaint

This is a fragment of one of the options in my dialog dDuo:

Code: ags

@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.

Pumaman

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.

freshpaint

Thanks. It works now. I missed this in the help file.

SMF spam blocked by CleanTalk