I have this code:
<input id = "input" type = "text" placeholder = "Type 'Help1' for actions"/>
<button onclick="button()">Confirm</button>
<p id="message"></p>
<script>
function button() {
var text;
var textInput = input.value;
switch (textInput) {
case "Help1":
text = "[Page 1 of 2. Type 'Help2' for page 2] Commands you can use: <ul><li>South</li><li>North</li><li>East</li><li>West</li><li>North Again</li><li>South again</li>";
break;
case "Help2":
text = "[Page 2 of 2] Commands you can use: <li>North One More</li><li>East Once More</li><li>West Once More</li><li>South Once More</li><li>East Again</li><li>West Again</li>";
break;
case "South":
text = "You went to the city; street 2. Do you want to explore?";
break;
}
}
</script>
Now say I wanted to add to my case for South. As you can see there's a question for it (and note: there are other cases after this one). I'd like to add something like a yes or no kind of thing and if I type in, "yes" it'll give me something like, "You had fun". And no giving me, "You decided not to explore South Street 2.
Is there anyway of doing something like this? I tried starting another case but that didn't work out. Neither do if and else if statements inside the case. Any feedback will be greatly appreciated.