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