About prompts: are there less annoying ways to get user input or should I use Ruby for my game?


Hi, I'm playing around with the template of Code your Own Adventure and I really don't like how the prompt looks when I'm trying to get an input for the user's choice. Can this prompt be altered to look different (at my level) or is there another way to get the user's answer without prompt. If there is, it will probably come up sooner or later in the course but I'm pretty comfortable/ happy/ enthusiastic about finishing this game so any help would be great.

I'll leave an example of the code to show you how i'm using prompts. The code will probably need a bunch of debugging but I'm at the drafting stage currently. If you see anything glaring, however, feel free to mention it.

thanks for listening ^.^

console.log("In the near distance, someone appears. They bare an uncanny resemblance to\
someone you used to...It is them!");

var userAnswer = prompt("Do you want to speak to them?")
if (userAnswer === true) {
    console.log("You break into a jog but the figure in the distance of your long\
    lost friend begins to fade. You run faster, trying to close the space between you.")
} // this is you crawling down the rabbit hole.
    else {
        console.log("You ignore the random appearance of your long lost friend\
        who happens to be wandering the same timeless shore as you. After they \
        disappear, you feel your disappointment begin to gnaw at you.")
    }; 						//game ends

console.log("The faster you run the more the impression of colours around you merge,\
suggesting speed. And then suddenly your friend is gone and you are somewhere new.");
console.log("You can still see the ocean, wherever you are. There is a bench.");
var userAnswer = prompt("Perhaps it would be best to have a think on the bench?")


In due course you will begin working with the HTML document tree (the key component of the DOM) and will be able to take user input through form fields and other input controls.

At present we are working at console level and don't have that at our disposal so must resort to built in debugging tools, aka dialogs in the form of pop-up windows.

Personally, I think it would be advantageous to keep forging ahead through the track. Don't lose sight of your idea, though. Just bookmark it and keep studying. With more knowledge this will be much easier.


Thanks for the response. I will bookmark it but I'm also going to practice a bit of Ruby on the segment that I have completed so far, just so I can have something to look at. Also, I need to practice some Ruby.