I feel like I’m missing something here. What is the intended purpose of door_to? Because the way I see it used (in the DM4 and punyinform manual), it seems like it does literally nothing. I did some testing and doors won’t work unless the room has a destination corresponding to door_dir, and then entering the door will take you to the room’s destination and completely ignore door_to.
With the standard library it seems like the only real use of door_to is for directionless doors (which is pretty useful)
In punyinform not even that works; it gives some errors:
[Puny error: DirPropToFakeObj called with non-dirprop]
[** Programming error: tried to find the ".&" of <string "You smell nothing unexpected."> **]
[Puny error: Invalid direction prop in GoSub]
Have you linked the directions from your locations to the door?
Object Library "The Library"
description "You are in a library. You can go to the east.",
Object Storeroom "The Storeroom"
description "You are in a storeroom. You can go to the west.",
Object my_door "door"
if (self in Library)
"The door leads to the storeroom.";
"The door leads to the library.";
if (self in Library) return Storeroom;
if (self in Library) return e_to;
found_in Library Storeroom,
has static door openable ~open;
Auraes points to the crucial part here. A door is like an extra room which lies between the two rooms. An exit property from the first room points to the door, and the
door_to property returns the ID of the second room. And an exit from the second room points to the door, and the
door_to returns the ID of the first room.
When you walk through a door, you can typically do it in two ways: Either you type “ENTER DOOR” (or whateer the door is called) or you type “GO NORTH” (or whatever the direction is). If you type “ENTER DOOR”, the library looks at the
door_dir property of the door and changes the action to “GO NORTH”. Thanks to this mechanism, any
after rules you write only have to care about “GO NORTH”.
I haven’t seen the directionless door feature. I’ll have a look and see if it’s something we want to include in PunyInform.
Also note that for your typical door, you can use the Simple Doors mechanism in PunyInform (see the PunyInform manual). This makes door definitions less cumbersome
There are some things in Inform 6 that feel pretty weird. Doors is one of them. It took me a long time to get my head around why doors are implemented the way they are. I have come to appreciate that the doors are actually quite clever and quite versatile.
As @auraes said, make sure that you define a door object which has the
door attribute and
door_dir properties. You can create door-like objects like stairways or bridges that do not have the
openable attribute, but for normal doors, they will usually have
openable and possibly
lockable. Also, don’t forget to give them
scenery, otherwise your players can pick them up and walk off with them.
Once you’ve defined the door object, add the connections to that door for the two rooms on each side of it. For example, if you have a screen door connecting the laundry to the backyard, the connection for the laundry may be
n_to screen_door and the connection for the backyard may be
s_to screen_door. It might help if you think of the door as a room between the other two rooms.
As @fredrik mentioned, a side benefit is that you can use commands like ENTER DOOR and it works like magic without you having to write any extra code.
Door_to was the original reason the Ring of Impdom was forged…
(my favourite debug-enabler item originally turned a door to a room to a door to the (now obsolete) debug room…)
enouth reminiscences. The point here is that door_to allow also things like teleporters set to different places, for a major example.
Best regards from Italy,