Did I stumble across an Inform 7 bug?

Hi there,

I’m trying to implement a system for a game I’m working on in which the parser reads input that needs to be directed to a separate character if the command begins with a forward slash. I’ve got the following code:

[code]The narrator is a person. Janet is a person.

After reading a command:
if the player’s command matches the regular expression “^/”:
now the player is the narrator;
let T be indexed text;
let T be the player’s command;
replace the regular expression “^/” in T with “”;
change the text of the player’s command to T.

Every turn:
If the player is not Janet, now the player is Janet.

The test chamber is a room. The printed name of the test chamber is “Test Chamber”. Janet and the narrator are in the test chamber. “[if the player is the narrator]Test chamber #001 operational.[otherwise]This is a lovely-looking test chamber.”[/code]
The code for the matching works correctly (although I’m sure there’s a cleaner way of handling it than having to bust out the regular expressions - I’m new to I7) and it seems to be directing input to the correct characters. The problem, however, arises with the descriptions it settles in on for Janet and the narrator:

…and it seems to settle in on calling Janet “your former self” from this point on despite the fact that the player is now Janet. Does anyone have any idea what’s happening here?

Thanks,
katz

It’s not an Inform bug. Remember that when the story begins there are three characters in the room: Janet, the narrator, and the player character. You can confirm that if you type SHOWME TEST CHAMBER as the first command. When you switch to another character, the original player character is not removed from the room and is shown in the room description as “your former self”.

The solution is to assign the player character to either the narrator or Janet initially: “The player is Janet.” Now the default player character (“yourself”) is never put into play.

Okay, that makes perfect sense. I was baffled - thanks so much for your reply. :slight_smile: