First, friendly housekeeping note: Questions about how to do stuff in Inform should be posted to the Inform board. [size=85][thread moved – George][/size]
Anyway, moving the player to another room is easy. All you have to do is say “move the player to [name of room goes here]”.
The more complicated part is making the game ask the question and respond to a specific answer that’s not an ordinary command. “Lion” won’t usually be a command that an Inform game understands, but you want to understand it when you are asking a specific question. There’s an extension that does that, called Questions, which you probably want to check out.
I whipped up a crude homebrew example, though. It’s mostly based on the documentation example Baritone, Bass, which you might also want to look at, but I had the questions triggered by examining the paintings instead of at the beginning of the game.
[code]A painting is a kind of thing.
Painting Test 1 is a room. “It’s like you’re living inside a captcha!” One painting is here. The description is “It’s a painting of a lion.”
Painting Test 2 is a room. One painting is here. The description is “It’s a painting of a zebra.”
Painting Test 3 is a room. One painting is here. The description is “It’s a painting of a pudu.”
Freedom is a room. “Sweet Freedom! Here’s where you’d do whatever happens next in the game.”
Room of Wrongness is a room. One painting is here. The description is “It’s a painting of a panda. A sad one.”
After examining a painting: now the command prompt is "What animal is in the painting, again? "
After reading a command when the command prompt is "What animal is in the painting, again? ":
if the location is Painting Test 1 and the player’s command matches “lion”: [“location” is just the room the player’s in]
move the player to Painting Test 2;
otherwise if the location is Painting Test 2 and the player’s command matches “zebra”:
move the player to Painting Test 3;
otherwise if the location is Painting Test 3 and the player’s command matches “pudu”:
move the player to Freedom;
otherwise if the location is Room of Wrongness and the player’s command matches “panda”:
move the player to Painting Test 1;
if the location is not Room of Wrongness:
move the player to Room of Wrongness;
now the command prompt is “>”; [note that this isn’t under any of the other conditions, we want to change the prompt back to the normal one no matter what the answer was]
reject the player’s command. [This just means: don’t process it as a normal command.]
A couple of things to note. The first is that the answers are very persnickety; if the game wants “panda” and you type “sad panda” it won’t accept it. This probably will be even more of a concern if the players are looking at real paintings instead of getting simple descriptions.
The other is that writing a special case for each painting would get unbearably tedious if the game were any bigger. If you were doing things like this, you’d probably want to systematize things more, using properties you assign to the rooms (for instance, you could assign each room some text for the answer and a room as the room they get moved to if they get it right) or a table.