Prompt vs. Console Battle for Interactivity



Hello, so I decided to make a complex choose your own adventure story. I was successfully able to solve at least two problems on my own (figuring out var =/==/== "string" condition setup for if/else loops, or the fact that I'd used toUpperCase; instead of toUpperCase(); in every single prompt!). So, although I have been able to solve syntax error issues, I'm having doubts about the practicality of my game. For example, I have a LOT of text and prompts that I am using to set the story.

Say I have a paragraph that I need the player to read in order to understand how to answer the prompt "Do you go into the cave or walk near the beach?". If there's a large block of text, only the end of that text is visible on the window, and the prompt pop-up doesn't allow the player to scroll in the output/console window until an answer is given.

Is there some sort of way to have the user signal that they are ready to move on? Like perhaps "Press any key to proceed..." statements or something? I've put a lot of work into this (about 2/5 done, at ~3200 words, and 450 lines. I'd like to know if this will ever be able to be functional for the player or if I should just be happy that I understand the principles and move on.... :laughing:

I'm not including coding because it's not the coding that is the issue, but the interactivity with the console and the prompt window popups...

Thank you wise helpers!



JavaScript dialogs are interstitial, and suspend execution when they are open. The program does not run in the background and only resumes when the dialog window is closed. This is a problem when there are successive dialogs in the program. The screen is not updated as we might expect.

It is worth learning on your own how to make JavaScript wait for a given time interval. This way your program can begin with some text on the screen, and a message that the prompt will appear in ten seconds (or enough time for them to read the story).

log some text and instructions
set a timeout interval
prompt user
process inputs and log some more text
set a timeout interval
prompt user
and so on...

The dialog closes and the user can read the screen for the duration of the timeout.


Hello @mtf !

Thanks for replying to my thread. I tried to do some searching for how I could prevent the prompt window from bothering the player, but never found the timeout event! I only found some confusing codes for "jQuery" that had maybe the "press any key to continue" approach that I was looking for. I'll try to look up some event delay/timing/etc. information up in the meantime.

I'll leave this thread open a bit longer, just in case someone else has anything they'd like to say. Otherwise, I'll mark it as answered a bit later.

Thanks again! I'm doing nothing but learning thanks to this community.


Sorry for the delay (pun intended). Setting up a delay in the console environment could be tricky in the absence of HTML, the Document in 'Document Object Model' (DOM). To my finite frame of reference it will be a tall order. But do ask around, and let us know what you find.


No matter! It's okay. :slight_smile: So, a delay wasn't ideal. But apparently I can run my code from chrome's console option directly. I just found out this is a possibility. And what is fantastic about that is that I can scroll through the output without the prompt on the top of the screen preventing the scrolling! This makes my adventure story MUCH more userful.

Thanks again for your help. I'm going to call this answered! :smiley:


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.