Trying to create a simple ‘Choose your own adventure game’ Help, I’m stuck!

Hey guys-

So I've figured out some of the very very basics of C# (started with C# yesterday, no previous programming experience.)

I'm trying to make a simple game in console commander. It will start with a paragraph explaining 3 choices you can make (1, 2 or 3). I've managed to figure out how to get he userValue input to relate to which secondary text shows up, depending on which choice (1, 2 or 3) is selected. However, once we get to the 'second tier' of the game, I am only getting input errors. Example:

"You can pick 1, 2 or 3" 1 "You can now pick 4 or 5" and then this is where the problem starts, inputting 4 or 5 only results in an input error. Can someone explain to me how to make this jump?

Console.WriteLine("Intro to game story, blah blah blah, outlining options"); Console.WriteLine("Enter 1 for Dragons"); Console.WriteLine("Enter 2 for Mermaids"); Console.WriteLine("Enter 3 for Browsing Reddit");

 string message = ""; string userValue = Console.ReadLine(); if (userValue == "1") message = "Fighting Dragon, then 2 options" else if (userValue == "2") message = "Something else"; else if (userValue == "3") message = "A different something else"; Console.WriteLine(message); Console.ReadLine(); if (userValue == "4") message = "I CANNOT GET THIS TO SHOW UP"; else if (userValue == "5") message = "THIS ALSO WILL NOT SHOW UP"; else message = "Incorrect Input!"; 

Console.WriteLine(message); Console.ReadLine();

by JosZ27 via /r/csharp

Leave a Reply