back with more check/carry out/report issues

I just can’t get check/carry out/report sorted out.

I’ve got a coin slot that is only supposed to work with a token which will unlock a door.

  1. If the token is dropped in the coin slot, the token should disappear (sending it to the limbo-ish “Blockland”), and the door should be unlocked.

  2. A metal blank should not trigger the door to unlock and should end up in the coin return.

  3. Anything other than these two items should not even be allowed to be put in the coin slot and give a message saying as much.

I’ve tried many, many variations on check, carry out, report code along with various instead and before code. Clearly I’m missing something because when I put anything (token, metal blank, or toaster) in the coin slot, I just get the message “You put the token/metal blank/toaster in the coin slot.”

I want to allow the verbs “drop” or “put” to work here rather than defining a new action for putting the token in the coin slot.

[code]The coin slot is in the Upper Hallway. The coin slot is a container. The coin slot is open. The coin slot is not portable. Understand “coin slots” as the coin slot.

The coin return is a container. The coin return is in the coin slot. The coin return is open. The coin return is not portable.

Check dropping in the coin slot:
if the player is not carrying the token or the player is not carrying the metal blank:
say “That won’t fit in the coin slot. Maybe try something more token-ish?” instead.

Carry out dropping the metal blank in the coin slot:
now the metal blank is in the coin return.

Carry out dropping the token in the coin slot:
now the token is in Blockland;
now the green door is unlocked.

Report dropping the metal blank in the coin slot:
say “The metal blank pops out in the coin return leaving the door locked. Obviously, this isn’t a token.”.

Report dropping the token in the coin slot:
say “You hear the token drop into a coin box, and the lock on the door disengages.”.[/code]

So yeah, I’m clearly missing something key here. Any help would be so, so appreciated.

There are a couple of things.

Firstly, the name of the action is “inserting it into”, not “dropping it in”. You need to be exact about this. So your rules will need to be of the form “Check inserting something into the coin slot”, “Report inserting the token into the coin slot”, and so on.

The reason this isn’t throwing up a compilation error is that your rules, “Check dropping something in the coin slot”, do make a sort of warped sense — Inform understands this as “Check dropping something when the player is in the coin slot”. That’s not what you want.

Second, your logic isn’t going to give you the result you’re after. Your “check” rule is only looking at whether the player is carrying both the token and the blank. It isn’t checking that the player is actually inserting one of them—maybe they’re trying to put something else in. And anyway, I shouldn’t have to be carrying the blank in order to put the token in the slot.

To fix this, you can change the condition to “If the noun is not the token and the noun is not the blank:”.

A couple of small things: your “carry out inserting the blank into the coin slot” rule isn’t needed; that’s the effect that the inserting action has by default anyway. And your two report rules will not prevent Inform’s normal report rule “You put the token into the coin slot.” from firing. To do this, either use After rules instead, or else add the instruction “Stop the action.” to your report rules.

Thank you! All of your suggestions worked perfectly. I appreciate your help.