Command prompt

After going to Bedroom:
	now the command prompt is "A question [line break]> ";

How can I complete this code in order to execute different actions based on the answer to the “question”? Let’s say I want the player to be moved to the Living Room if the answer entered by the player is the word “answer”. How could I do that?

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;
	no.
	
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;
	otherwise:
		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.

2 Likes

Another working example of this can be found here: http://ajmako.com/interactive-fiction/the-bridge-of-death/ (shameless plug).

1 Like