If-else statements and ending the game

I am writing my first Inform7 game and am running into difficulties creating an if-else statement.

This is what I would like to write (in pseudo-code):

You want to open whitebox. if redbox is (already) in the tub, then Peter opens whitebox then the game is over say "Peter has opened whitebox! The game is over." else if redbox is not in the tub, whitebox stays closed say "you need to drop redbox into the tub first before Peter can open whitebox."

How would I go about writing this in Inform 7?

Start reading through chapter 7 of the manual, “Basic Actions”. You want to write a rule that starts

Instead of opening whitebox: …

Or, if you want to catch the command “PETER, OPEN WHITEBOX” then read chapter 12.3.