I don't use the text parser globally in the game, but there are a few sections where I want the player to answer riddles using a text box. Here is my code:
gTextBox1.Visible = true;
riddle = Answer.Text;
Parser.ParseText(riddle);
if (Parser.Said("chess [game]"){
cDarkKnight0.Say("That's correct!");
}else{
cDarkKnight0.Say("That's incorrect.");
} gTextBox1.Visible = false;
I keep getting an error that says "end of input reached in middle of expression." Am I missing something stupid?
gTextBox1.Visible = true;
riddle = Answer.Text;
Parser.ParseText(riddle);
if (Parser.Said("chess [game]")) {
cDarkKnight0.Say("That's correct!");
}
else{
cDarkKnight0.Say("That's incorrect.");
}
gTextBox1.Visible = false;
You just forgot a small ) on if (Parser.Said("chess [game]")) {
I fixed the code above, so you can copy replace.
Two things: please always point out the line which the error refers to in case things aren't clear.
And you'll probably want to move the code that handles the input into the TextBox's OnActivate function.
In the code you posted you're turning on the GUI holding the textbox I guess, so subsequently riddle will be "" and nothing will happen.