'Press enter to continue' command

Brian5757
31 Mar 2020, 04:31

For a text adventure I need to show the player some lines of text then have the player push any key on his keyboard to continue and the next few lines of text will appear. Is there a quest command to do this?

It would be useful so that player reads a certain number of lines of text at a time for either the room description or a msg(" ") command.


mrangel
31 Mar 2020, 09:19

There's a wait command; I think "Wait for key press" on the GUI; I think it's in the 'output' section.
It replaces the command bar with a message (I think it's "Press a key to continue"), and the player can press a key or click on it.

There are other ways to do this with javascript, but that's the built-in option.


Brian5757
31 Mar 2020, 21:41

Hi mrangel.

I tried using the pause command as you suggested by I got this message:
The Pause function is obsolete as of Quest 5.5

I'd welcome any other suggestions thanks.


mrangel
01 Apr 2020, 00:23

Pause?

I suggested using the wait command.


Brian5757
01 Apr 2020, 09:57

Hi mrangel

Opps my mistake.
I tried wait as you suggested but I'm not certain if I'm using the wait command correctly.
msg ("This is line one")
wait
msg ("This is line two")

I want the first message to display then after the player presses a key I want the second message to display
At the moment both messages display then there is a 'continue' word under the box the player enters commands into.


mrangel
01 Apr 2020, 10:18

You want:

msg ("This is line 1.")
wait {
  msg ("This is line 2.")
}

In a similar way to ShowMenu, the wait block makes a note of a script to run after the button is clicked. (But I think wait also saves the scope frame, so your local variables stay around. Not 100% sure about that, because I've not really used it)


Brian5757
02 Apr 2020, 02:03

Thanks mrangel.
That works the way I want it to.