How to make a Display skip automatically?

Started by Victsantgt, Tue 19/12/2023 21:11:06

Previous topic - Next topic

Victsantgt

Hello! I've seen searching through the manual and the forum all day, but couldn't find a solution to a problem I've been having.

Basically, I am trying to create a typewriter styled dialogue box using displays and substrings.

However, I've managed to get everything working as I wanted, except for one thing. Despite all my efforts, the displays don't skip automatically, and you need to click with the mouse to advance through the display letter by letter.

Is there any way to make the display skip to the next one?

This is the code I have for reference:
Code: ags
String text = "test";
  for (int i = 0; i <= text.Length; i++)
  {
    String substring = text.Substring(0, i);
    DisplayAt(50,400,500, substring);
  }

Crimson Wizard

#1
Display command is "super blocking", which means that no script is run when it's on the screen, not even "repeatedly_execute_always", and so it cannot be skipped by a command from the script. So will be unusable in your case.

For your case the solution is to not use Display at all, but use other means: GUI with label, or Overlay.CreateTextual, combined with Wait function.
If you are using GUI with a label, then you just need to assign new text to a label on its step.
If you are using Overlay, then you would need to save created overlay in a variable, and call Remove to delete old overlay before creating a new one with a longer text.

EDIT: I might also mention a TypedText module, that does this effect in many kind of ways:
https://www.adventuregamestudio.co.uk/forums/modules-plugins-tools/module-typedtext-0-7-0/

Victsantgt

Thank you! Afer adapting the code for labels it worked like a charm!

Really grateful for your help!

SMF spam blocked by CleanTalk