In your example, you’re still declaring the “outcome” variable inside a rule (the instead rule), so your after reading a command rule won’t recognize it. I think you’re going for something like this:
[code]Test Chamber is a room.
A man called Steve is in the Test Chamber.
The outcome is some text that varies.
Instead of asking Steve about something:
now outcome is “”;
After reading a command while outcome is “”:
now outcome is “[player’s command]”;
if outcome is “foo”:
say “FOO!”;
otherwise if outcome is “BAR”:
say “BAR!”;
otherwise:
say “ERROR!”;
reject the player’s command;
[/code]
That compiles, although I’m not 100% it will do what you want. A few observations:
-
When you declare outcome as a text that varies, it will initially start out as an empty string (“”), which means that the very first command of the game will trigger your after reading a command rule. Unless that’s what you want to happen, you might want to set outcome initially to some arbitrary default value.
-
Be aware that the “reading a command” rules are checked long before the instead rules are ever triggered. That means that when you try to talk to Steve, the game will first do nothing, then it will start the next turn, and THEN it will check the player’s input for “foo” or “bar”.
-
When the after reading a command rules are finished, they allow the parser to proceed as normal unless you specify to “reject the player’s command.” Otherwise you’ll get output like this: