Automated Drawers by Emily Short

Does anyone have much experience working with this extension?
I’m attempting to make it so that an object is in a drawer, but no matter how I phrase it I can’t seem to make inform understand what I mean.
I’m not having any other problem with containers that are parts of things and placing objects inside them.
For some reason, I can’t do it with drawers. The desk is a fixed in place supporter in the apartment. Three vertical drawers are part of the desk. The description of the desk is "It is a very nice desk, and it is very well used." I’ve tried all of the following permutations, plus some I can’t remember right now:[code]clutter is a thing. Drawer one of the desk contains clutter.

clutter is a thing. The top drawer of the desk contains clutter.

clutter is a thing. The first drawer of the desk contains clutter.[/code]No matter how I write it, the top drawer of the desk is always empty.
What is the proper inform grammar for getting this to work?

Interesting. Looks like a bug to me. Whatever drawer you pick when referencing the drawer, the contents still end up in the drawer with the highest index number (the lowest drawer in this instance) part of the same item.

Another odd thing: using Showme, I looked at the three vertical drawers I created to try to spot differences in things like drawer numbers. I found that the drawers are numbered 1 (top), 2 (middle) and 4 (bottom), which may relate to the bug. In point of fact the assertion “three vertical drawers are part of the desk” creates four drawers.

EDIT: Curiouser and curiouser. Adding an item inside a drawer before the game begins is what triggers the bug. The item is not placed in an existing drawer but a new one.

My conclusion: I’m unsure of what’s happening, and this should probably be reported. In the meantime, if you still need to work on the project, I cobbled together a stopgap solutionmethod. It’s ugly, hackish, and mostly untested, but you should be able to use it for the moment:

To decide which drawer is the real (placing - a drawer position) drawer of (holder - an object): repeat with tray running through drawers part of holder: if the drawer position of the tray is the placing, decide on the tray.

…and usage is as follows:

When play begins: now the clutter is in the real top drawer of the desk.

The reason for this is that the names “top drawer,” etc., don’t refer to single objects in the game world; a drawer is assigned the identity of “top” depending on what other drawers are part of the same object. That means that, yes, it’s necessary to populate them at runtime rather than at the beginning of the game.

I had vaguely thought I discussed this in the docs, but possibly not – I don’t have time to have a look now, but will do so for a future release.

I think I must have misunderstood what this extension is for. Based on the name, I assumed it was something that would only be useful for those who write “adult” IF (and that if you don’t select the “use American dialect” option it might be called something like “mechanised knickers”). :open_mouth:

Robert Rothman

I managed to get it working using Eleas’ method of deciding the real drawer.

I didn’t think that pre-populating drawers would be so messy!

It will be a lot easier if you define the drawers one at a time, instead of making them anonymous.

The desk is a fixed in place supporter in the apartment. 
A vertical drawer called the top drawer is part of the desk.
A vertical drawer called the middle drawer is part of the desk.
A vertical drawer called the bottom drawer is part of the desk.