Making a one shot key in Inform 7

I want to make a key that breaks after being used. I really thought I was getting a handle on Inform 7, but I must not be grasping it right, because I keep getting coding errors.

Instead of unlocking the heavy door:
remove the bobby pin from play;
the heavy door is now unlocked;
say “The bobby pin snaps in two with an audible click, and sadly you discard the broken pieces. The pin did not give its life in vain, however, as the door is now unlocked.”.

I don’t understand why that won’t work. Can someone help?

It looks like you should change the first line to “Instead of unlocking the heavy door with the bobby pin:” and the third line to “Now the heavy door is unlocked;”.

On the first one, after a little fiddling, it may be the case that when an action takes two nouns, the rule header either has to specify no nouns or both of them – so “Instead of unlocking” compiles, and “Instead of unlocking the heavy door with the bobby pin” compiles, but “Instead of unlocking the heavy door” doesn’t. (I’ve tested this on one other action.) If you wanted the effect of “Instead of unlocking the heavy door” you could write “Instead of unlocking the heavy door with something:”.

(But you don’t want that effect! If you wrote “Instead of unlocking the heavy door with something,” then the player could unlock it with any old thing and get your message about the bobby pin. So in this case it’s lucky that it didn’t compile, because it would’ve introduced a bug in your game if it did.)

On the second one, you have to put “now” at the beginning of a line like that – Inform 7 looks like English, but this is one of (many) cases where something that’s grammatical in English isn’t in Inform.

By the way, it’s easier to deal with your code if you put it in code tags (use the button above the window where you type your post); that will preserve your indentation.

The first thing to ask is whether you’ve formatted it correctly. Unfortunately, Inform does care about whitespace sometimes, and this is one of those times. Make sure you’ve got one tab at the beginning of each of the lines after the first one. (And in the future, if you’re trying to show us your formatted code, you can use the “code” tag, which won’t swallow the tabs quite as thoroughly.)

The second thing is that I believe your second line should be “now the heavy door is unlocked” (with the “now” at the beginning).

[Oh I got scooped by mattw, but my point about whitespace still stands.]

Thanks! Worked like a charm!