Here’s one way to do this:
The Corridor is a room.
The Bedroom is west of the Corridor.
The Living Room is east of the Corridor.
After going to the Bedroom:
now the command prompt is "A question? >".
To decide whether answering a question:
if the command prompt is "A question? >", yes;
After reading a command when answering a question:
if the player's command matches "answer":
move the player to the Living Room;
now the command prompt is ">";
reject the player's command;
say "Sorry, that's not the answer.";
reject the player's command.
I adapted this from the documentation, which has some information in the examples 309 and 416 and in chapter 18.33.