Attempt two: request for feedback on adventure game

This is an incomplete app. I am wondering why document.getElement doesn’t change text. Does text only change once function is completely done? Console.logs show up so why not the doc( etc.)s?

Here is link.
Any insight would be gratefully accepted.

I’ve messed with it some more but it seems to only show the new text after the function is complete. Is my observation accurate?

This isn’t an answer to your question, but if you want to make text adventure games, I would heartily recommend Inform7. It is the most interesting programming language I have ever come across (it is designed to mirror natural English) and it’s sole purpose is for creating text adventures!

It is so much fun!

Hi :slight_smile:

I really don’t understand your code, with comments it would be more readable.

I create a pen in codepen:


I don’t understand (the problem), when I click the button “Let’s begin!” change to “Start Room” (document.getElementById() is working, is changing the text:)

 document.getElementById("dialogue").innerHTML = "Start Room";

The rest of the code:

var answer;
var room;
var shield;		
	function start(){
		console.log ("startroom");
		answer = prompt("You are in a room with a door to the north and a door to the south. Which way do you want to go?");
		document.getElementById("dialogue").innerHTML = "Start Room";
			if (answer === "go north"){
				document.getElementById("dialogue").innerHTML = "Dragon Room";
			} else if (answer === "go west"){
				document.getElementById("dialogue").innerHTML = "west Room";
			} else if (answer === "go east"){
				answer = prompt("you can't go east. Which way do you want to go?");
			} else if (answer === "go south"){
				answer = prompt("you can't go south. Which way do you want to go?");
			} else if (answer === "quit") {
				document.getElementById('dialogue').innerHTML = "bye!";
			} else {
				answer = prompt("Please choose from available answers. Which way do you want to go?");
	function dragon(){
		console.log ("dragon room");
		answer = prompt("There is a dragon here. What do you want to do?");
		if (answer === "quit");
		document.getElementById("dialogue").innerHTML = "Too late, you were eaten.";
	function west() {
		console.log ("westroom");
		document.getElementById("dialogue").innerHTML = "west Room";
		answer = prompt("You are in a room with a shield. What do you want to do?");