So I’m trying to use the *input_text feature to make a game in the style of the old text adventure games where the player types in commands like “go north” “explore cave”, etc. My first simple experiment with whether it would work using variables and an if/else statement seemed to work, but when I tried to do one with more *if statements, the *else for unaccepted statements just defaulted to a blank page instead of my *else “that input doesn’t work” dialogue. Here’s my test that I did to see if it would work:
To progress through the game, you must input commands to control Curtis’ actions. Most of these commands will involve having to Enter, Exit, Go to, Talk, Examine, or Investigate a subject. For example, to proceed from this scene, type the phrase, exit bus. (if the command is denied, check capitalization–case sensitivity may be an issue with the code)
He steps off the bus and it speeds off, leaving him standing on the street in the early morning light. He takes a deep breath, scoping out his surroundings and planning his next move in the town.
Curtis: “Okay… I guess I’m doing this. I should probably find somewhere to stay. But it’s early, so I could probably have a look around.”
Try again! Make sure you type it exactly like this: “exit bus”
*if command=“exit bus”
That ran okay when I tried it out in a browser, so I tried moving on to the starting point of my game, which is an intersection with multiple paths the main character can choose to take. I made a variable for each path and set up the command under the text like this:
*input_text command1 or command2 or command3 or command4 or command5
*if(command1=“go to university”)
*if(command2=“go to mansion”)
*if(command3=“go to shops”)
*if(command4=“go to harbor”)
*if(command5=“go to boarding house”)
Unsupported text! Try using go toand one of the locations in bold!
It runs, and when I go to the label I’ve written details for (UniversityBranch) it shows the right information. But if I input random gibberish in the text input, it doesn’t show the “unsupported text” message. Am I doing something wrong here? I felt like I was getting the hang of it for a second and then I wasn’t.