I have a project that requires us to make a text based game.
My game has a small talk method that only occurs between two characters. What is supposed to happen is that when you initiate the command by putting in "talk" which is changes a boolean variable to true which changes the available command words to only "help" and "say".
The help command works but the say command does nothing. You are supposed to type say and a number out of a list of available sentences that prints out, but it will not work.
The debugger suggests that the parser is skipping over the section in the code that uses the command while it is searching for available commands.
Here is the section with the command:
gui.println(commandLine);
Command command = parser.getCommand(commandLine);
if(command.isUnknown()) {
gui.println("I don't know what you mean...");
return;
}
String commandWord = command.getCommandWord();
...
else if(player.getTalk() == true)
{
if (commandWord.equals("help")){
gui.println(player.talkHelp());
}
else if (commandWord.equals("say"))
gui.println(player.talking(command));
}
the first if (marked by the ...) before hand is if getTalk() is false and holds all of the regular commands.
the talking command just takes the second word and if it equals 1,2,3,4, or 5 will print out the sentence.
Sorry this is wordy but I wanted to fully explain.

