Like “move player to Dank Cellar”, “if the player is in the sewer” needs to be inside a rule or phrase; otherwise Inform doesn’t know what to do with it. You could create a Rat Attack scene and put your code in a “When Rat Attack begins” rule, but in this case that would be overkill. Here’s how I’d do it:
Every turn when the player is in the Sewer and the giant rat is in the Sewer:
if in darkness:
say "The gleaming eyes of a giant rat peer from the out the darkness. Scuttling your way with startling speed, it launches itself upon you and gnaws a gaping hole into your neck. In death, your body is eaten over the course of several weeks.";
end the game in death;
otherwise if the cat is in the Sewer:
say "The giant rat and cat fight each other to the death.";
remove giant rat from play;
remove cat from play;
move rat corpse to Sewer;
move cat corpse to Sewer;
otherwise:
say "A giant rat kills you.";
end the game in death.
There are a few things to note here:
- “If the sewer is dark” will be true even the player is carrying a light; it tests whether the room itself is lit, not whether something is lighting the room. You need to use “if in darkness” instead.
- With your code, the giant rat will kill the player any time the Sewer is lit, whether or not the cat is in the Sewer. Putting the cat-and-rat-kill-each-other section before the rat-kills-player section fixes this.
- “End game” isn’t a phrase Inform understands. You have to use “end the game in death”, “end the game in victory”, or "end the game saying “some text”’.
- You can’t move more than one thing at once by saying “remove the giant rat and the cat from play” or “move rat corpse and cat corpse to sewer”. You have to move them separately.
- “If” statements in square brackets, like “[if lit]”, can only be used inside blocks of text, like “say “The fridge is [if the fridge is open]open[otherwise]closed.””. Outside a block of text, anything in square brackets will be interpreted as a comment and ignored.