ESC to exit a dialog (conversation)

Started by Gurok, Sat 01/03/2014 14:04:57

Previous topic - Next topic

Gurok

Hello,

When conversing with another character, is there an easy way to allow the player to press ESC to exit the dialog? Ideally I'd like to be able to have the player say goodbye when ESC is pressed, but I'd settle for just stopping the dialog.
[img]http://7d4iqnx.gif;rWRLUuw.gi

Crimson Wizard

#1
The only way I know to intercept a keypress when dialog options are display is to do this in repeatedly_execute_always:

Code: ags

function repeatedly_execute_always() {
  if (IsKeyPressed(eKeyEscape))
  {
    // do something
  }
}


Now, the problem is that:
- StopDialog() only works when being called from a dialog_request handler (that is - after certain option was chosen and "run-script" command is used under that option).
- It will perhaps be better anyway if certain "ending" dialog part was played, otherwise this will act the same for every dialog.

The solution is either
1) script your own dialog options system (probably not very difficult), or
2) try making new "BreakDialog" and/or "RunDialogOption" script functions :).

Gurok

I took a look at the code and I think it's easier to just live with limited dialog options for now.

Thanks for the answer though, CW. I appreciate the perspective.
[img]http://7d4iqnx.gif;rWRLUuw.gi

SMF spam blocked by CleanTalk