# Dropping an item down a hole

This has to be a fairly common thing, and there must be a standard for how to do it. I have a couple of vertical doors - trap doors, holes, ladders and so on - and I want to be able to drop an item down a hole - “drop sword into crevice”, for example, and thereby moving the sword into the room that’s at the other side of the hole.

It seems natural to define “holes” as a new thing - a kind of door - and then define dropping behavior to allow one to drop an item into a hole (appropriately disallowing movement other than above to below).

I’ve read the sections on pushing and throwing, but found nothing that seems to work - and Inform seems determined to treat “drop X into Y” as a container-based statement (“That can’t contain things”) no matter what rules I try to write for holes.

Is there a library or standard kind/rulebook written to solve this class of problem?

[code]A hole is a kind of door.

The dropping action has an object called the hole dropped into (matched as “into”).

Check dropping the wooden tau cross into the gap in the stone:
say “you can’t drop the wooden tau cross into the gap in the stone!”.

Before dropping the wooden tau cross into the gap in the stone:
if the player is in the Shrine of Thyr:
say “dropping the wooden cross.”;
now the wooden tau cross is in the Grange of Thyr.[/code]

the above doesn’t trigger (obviously I’m trying more than one thing here); neither does an Instead rule.

The action that fires when you try to DROP CROSS INTO GAP is “inserting the cross into the gap”. It’ll be easiest just to use this action.

```Instead of inserting something into an open door: let the place be the other side of the second noun from the location; move the noun to the place; say "[The noun] is now in [the place]."```

…what Draconis said, but longer…

``The dropping action has an object called the hole dropped into (matched as "into"). ``

This would be something that could only work for the dropping action as is–the one you get with “DROP SWORD.” (If you were doing something like this, you’d need a "setting action variables for dropping " rule to set the action variable “hole dropped into” to something. But you wouldn’t be able to winkle it out of the player’s command because, well, it doesn’t work that way. To give you an example of how it does work, when the player types “GO NORTH,” the action is going north, and then the setting action variables for going rules set the room gone from to the room that the player is in, and the room gone to to the room north of the player if there is one.)

deep breath Anyway, the solution is a lot simpler! The command “DROP SWORD INTO HOLE” maps into the “inserting it into” action. If you try inserting something into a non-container, it gets blocked by the “can’t insert into what’s not a container” rule, which is a check inserting rule. But Instead rules run before check rules, so you can just take care of this with an Instead rule:

[code]The Surface is a room.

The sinkhole is an open unopenable door. The sinkhole is down from the surface and up from the Underworld.

The player carries a sword.

Instead of inserting something into the sinkhole when the location is the Surface:
say “[The noun] plunges out of sight.”;
now the noun is in the Underworld.

Instead of inserting something into the sinkhole when the location is the Underworld:
say “You can’t get that up to the surface without climbing up there yourself.”[/code]

This also catches “put sword into sinkhole,” which is good.

(If you wanted, you could define a new “dropping it into” action and do some work to redefine “drop [something] into [something]” to get to that action, and then I think your rules would work, because Before rules also run before Check rules–except you need to add “instead” or “stop the action” to your Check rule, because the one you’ve got would let the action continue; and you’d also want to add “rule succeeds” to the Before rule, so it doesn’t go on to try processing the action normally. Probably if you did it that way you’d want to have a Carry Out rule that moves the dropped object and a Report rule that prints the message, with Check rules to make sure that the second noun was a hole, that you’re on the top side of the hole, etc. But it’s a lot simpler to hook on to the existing inserting it into action, especially because having DROP SWORD INTO SINKHOLE work when PUT SWORD IN SINKHOLE doesn’t is the kind of guess-the-syntax puzzle that angers people up.)

Looks like other people have already answered, but I’ll post what I came up with anyway:

``````A hole is a kind of container.

A hole has a room called the destination.

After inserting a thing (called the item) into a hole (called the designated hole):
now the item is in the destination of the designated hole;
say "[The item] disappear[s] into [the designated hole]."

Lab is a room. "A lab. Down from here is the basement."

A laundry chute is a hole in Lab. The destination of the laundry chute is the Basement.

Basement is a room. The Basement is down of the Lab.

The player carries a marble.

Test me with "drop marble in laundry chute / down".``````

You folks rock. Thank you!!!