In my games I have a keyring of four keys–there are four things that these keys unlock, however it’s actually the keyring that’s ‘the matching key’, because at the time I started working with Inform(May last year), I was not yet versed in some of the intricacies of the language. So instead of having four separate keys on a keyring, I made them all one ‘matching key’–the keyring itself, and used Understand statements equating “house/mailbox/car/utility key” to the keyring. It works, but the player may be a little cockeyed when he finds out he can unlock the mailbox with the ‘house key’, etc. or the keyring itself. So although I describe the keyring as having four different keys on it, you can type in the name of any key to unlock one of the items, but you cannot remove any of the keys from the ring, or add any. Now that I am doing a super-overhaul edit of my games, I need a ‘real’ keyring.
I toyed with the idea of making each key a ‘part of’ the keyring, but issues over having to ‘take’ a key first obviously arise. So my choice was to make the keyring a portable supporter, and putting the keys on the ring. I would then have the player ‘try silently’ taking each key(and I have put the keys into a kind, such as mykeys) before use. I would put this all under a Before rule, which stops the action in the case that the wrong key is typed. An After rule is then invoked in case of success, where I say ‘You unlock the door(etc)’, and then have the player ‘try silently’ putting the key back onto the ring. This all works perfectly. Except when I try to write some rules about taking a key from the ring. Now, if the player has the key off of the ring, and uses it, it works fine, he only puts the key back on the ring(silently) if the key was previously on the ring(if the mykey was on the keyring:…). However, when I write a rule about taking the key off of the ring, such as–
After taking a mykey:
if the noun was on the keyring:
say "You slide the key through the metal spiral, until it pops off into your hand.";
otherwise:
say "Taken."
—this rule will be invoked if I use a key on the ring to unlock something, even if it was not my intention for the player to take the key off of the ring. It will say –
UNLOCK SHOEBOX HOUSE WITH HOUSE KEY
You select the house key on the keyring.
You slide the key through the metal spiral, until it pops off into your hand.
You unlock the shoebox house.
Now because I have the player ‘try silently’ putting the key back on the ring, if it was previously on the ring, the key goes back onto the ring, so I don’t want the middle statement to print.
Any ideas?