I guess I must be doing something incorrectly, but it does seem as if the way one specifies the item location (current) has to be the same as the home of the item.
"Mallard v4" by Gary
A decoy is a kind of thing.
Room-belonging relates one room (called the home) to one decoy.
Supporter-belonging relates one supporter (called the home) to one decoy.
Container-belonging relates one container (called the home) to one decoy.
The verb to belong to (he belongs to, they belong to, he belonged to) implies the reversed room-belonging relation.
The verb to belong on (he belongs on, they belong on, he belonged on) implies the reversed supporter-belonging relation.
The verb to belong in (he belongs in, they belong in, he belonged in) implies the reversed container-belonging relation.
Definition: A decoy is secure if it is in its home or it is on its home or it is enclosed by the player.
Definition: A decoy is unsecure if it is not secure.
Every turn:
repeat with item running through unsecure decoys:
if best route from the location of the item to the home of item is a direction (called indicated direction):
say "[The item] spreads its wings and flies [indicated direction] back to [the home of item].";
move the item to the home of item;
otherwise:
say "[The item] can't find the way home to [the home of item], since the indicated direction is '[indicated direction]'.".
[---------------------------------- Main -----------------------------------------]
Hallway is a room.
The Hall table is a supporter in the hallway.
The drake is a decoy on the hall table. The drake belongs on the hall table.
The Passage Door is a closed door. It is west of the hallway and east of the living room.
The Living room is a room.
The mallard is a decoy in living room. The mallard belongs to the living room.
The Dining room is west of living room.
The box is a container in dining room. The duck is a decoy inside the box. The duck belongs in the box.
Test me with "take drake / w /close door / drop drake / look / open door / take mallard / w / put mallard in box / look / take duck / drop duck / look / e"
Testing yields:
[code]
Mallard v4
An Interactive Fiction by Gary
Release 1 / Serial number 140202 / Inform 7 build 6G60 (I6/v6.32 lib 6/12N) SD
Hallway
You can see a Passage Door and a Hall table (on which is a drake) here.
test me
(Testing.)
[1] take drake
Taken.
[2] w
(first opening the Passage Door)
living room
You can see a Passage Door and a mallard here.
[3] close door
You close the Passage Door.
[4] drop drake
Dropped.
The drake can’t find the way home to the Hall table, since the indicated direction is “nothing”.
[5] look
living room
You can see a drake, a Passage Door and a mallard here.
The drake can’t find the way home to the Hall table, since the indicated direction is “nothing”.
[6] open door
You open the Passage Door.
The drake can’t find the way home to the Hall table, since the indicated direction is “nothing”.
[7] take mallard
Taken.
The drake can’t find the way home to the Hall table, since the indicated direction is “nothing”.
[8] w
Dining room
You can see a box (in which is a duck) here.
The drake can’t find the way home to the Hall table, since the indicated direction is “nothing”.
[9] put mallard in box
You put the mallard into the box.
The drake can’t find the way home to the Hall table, since the indicated direction is “nothing”.
The mallard spreads its wings and flies east back to the living room.
[10] look
Dining room
You can see a box (in which is a duck) here.
The drake can’t find the way home to the Hall table, since the indicated direction is “nothing”.
[11] take duck
Taken.
The drake can’t find the way home to the Hall table, since the indicated direction is “nothing”.
[12] drop duck
Dropped.
The drake can’t find the way home to the Hall table, since the indicated direction is “nothing”.
The duck can’t find the way home to the box, since the indicated direction is “nothing”.
[13] look
Dining room
You can see a duck and a box (empty) here.
The drake can’t find the way home to the Hall table, since the indicated direction is “nothing”.
The duck can’t find the way home to the box, since the indicated direction is “nothing”.
[14] e
living room
You can see a Passage Door, a mallard and a drake here.
The drake can’t find the way home to the Hall table, since the indicated direction is “nothing”.
The duck can’t find the way home to the box, since the indicated direction is “nothing”.
[/code]