Changing the destination of a door

How do I change the destination of a door in I7 at runtime? I can’t find a version of the now ... syntax that implements it, and there doesn’t seem to be a version of a command like change the north exit of the Origin Room to New Destination Room that applies to doors. The I6 door_to property solves this problem in isolation, but I6 and I7 doors don’t play nicely together.

I think this works:

change the DIRECTION exit of DOOR to NEW ROOM.

EDIT: actually looks like that just works for rooms, not doors, oops! I seem to recall there’s something like a “now ROOM is mapped…” instruction that might do the job? Alternately, I think Hanon’s Easy Doors extension makes this all much, well, easier.

EDIT 2: from a quick perusal of the forum is appears this actually isn’t possible out of the box, so it does require an extension. Yet another reason not to use doors!

2 Likes

Odd, I don’t know why I7 wouldn’t want to carry over a pretty basic thing, especially when its design took great effort to allow now ... commands to cover a wide variety of cases. But yeah, I agree: I7 doors are considered harmful.

My impression from just skimming over the Easy Doors extension is that it’s fundamentally an I7 veneer over I6 doors (and I certainly won’t complain if doors become static and two-sided by default), with a bit of extra code to help out with pathfinding and mapping. That’s fine, but if there’s no way of doing what I want in native I7, I might as well drop in I6 code directly and do it properly.

2 Likes

Yeah, “now ROOM is mapped” works with map connections but not doors, as I recall since doors work almost like their own nonexistent liminal location you hook rooms to both sides of.

Easy Doors is a kludge originally designed to simplify three scenarios:

  • Alice in Wonderland’s corridor of doors as one location where Inform doors would normally limit you to four (or eight if using diagonals) doors in one location.
  • Simulating two doors on the same wall, such as a regular map connection and a broom closet.
  • An openable and closable and potentially lockable doorway that can lead into or out of an enterable container - like a box-truck or a rail car - that can actually move along with whatever it’s attached to and change destinations. Or providing access onto and off of an enterable supporter, like a loading dock.

Another fun use is you can make an Easy Door portable, like the black hole the player can carry around in Leather Goddesses of Phobos.

While working with Easy Doors, I found another scenario is an Easy Door can represent an entire enterable location: if you’re making a street or a hub location with shops or enterable buildings; you can describe an Easy Door as if it’s an entire grocery store exterior so it could stand in for an entire building that is enterable and leads somewhere else on the map.

4 Likes

Yep, this is unfortunately not something Inform handles out of the box. Doors are a bit of a weird edge case in the mapping code and this is one of the consequences.

Easy Doors aren’t actually I6 doors—they’re objects that can be ENTERed but aren’t associated with directions.

2 Likes

I’ve had some success with making doors private-named and using things like “understand “door” or “wooden” or “eastern” as the eastern-door when the eastern-door is revealed”. This usually keeps players from finding the door until the door gets ‘revealed’ by some other line of code. You can change the printed name to something like ‘the feeling that something is missing’ in case it gets printed.

This won’t help a single door that needs to open to alternate rooms depending on your actions though (so no elevator, Tardis, or Howl’s Moving Castle).

3 Likes

This won’t help a single door that needs to open to alternate rooms depending on your actions though (so no elevator, Tardis, or Howl’s Moving Castle).

That is, unfortunately, exactly the situation I’m in. (Also, the door itself is nontrivial: it’s lockable, etc.) Would something like what you describe work if I create two doors and make the name of one or the other untypeable depending on the situation?

1 Like

I was thinking that, but the issue is that they can’t both be mapped ‘east’ from the room, for instance (I’m pretty sure). If it was just ‘enter door’ with no direction attached it might work (you could invent new directions so players can’t find it by just mashing).

I understand you don’t want to use Easy Doors, but a Tardis is pretty easy. Make an Easy Door called “The Tardis” and describe it as a blue police box. Even if it is not portable, the author can still move it to other locations using rules, but it can be set to always lead to a “Tardis Interior” location. Then the exit Easy Door inside the Tardis can similarly change where it leads to if the player manipulates switches or dials inside: Now Tardis Interior Door leads to Kensington Gardens. Now the Tardis is in Kensington Gardens.

An elevator implementation is exactly the same with different descriptions, and changing which floor the “Open Elevator Door” Easy Door is located at, and changing its interior exit door inside the elevator car to lead to the correct floor based on button presses.

3 Likes

Or, possibly, you could make a blank room on the other side of the door, and make a custom rule that after you go through the door, it whisks you immediately (without printing the room description) to another room. I can try rigging up a prototype of that to see if it’s easy or messy.

2 Likes

Hmm, I wrote this without seeing Hanon’s answer, so this is probably useless and/or recreating what he did, but this works:

"Sandbox" by Brian Rushton

The Tardis Interior is a room.

An Endless Void is a kind of room. "This room description should never print".

Gallifrey is a room.

An endless void has a room called the true destination. The true destination of an endless void is usually tardis interior. 

The tardis exterior is an endless void. The true destination of the tardis exterior is Gallifrey.

A magic door is a kind of door. The printed name of a magic door is usually "blue door".

The blue door is a magic door. The blue door is north from tardis interior and south from tardis exterior.

After going through a magic door:
	if the player is in an endless void (called currentvoid):
		now the player is in true destination of the currentvoid;

The galli door is a magic door in gallifrey. The galli void is an endless void. The galli door is south from gallifrey and north from galli void.

Earth is a room. The earth void is an endless void. The earth door is a magic door. It is south from earth and north from earth void.

Report opening a magic door:
	now every magic door is open;
	
Report closing a magic door:
	now every magic door is closed;
	
Report locking a magic door with something:
	now every magic door is locked; 

Report unlocking a magic door with something:
	now every magic door is unlocked; 

XYZZYing is an action applying to nothing. Understand "xyzzy" as xyzzying.

Carry out xyzzying:
	say "The destination of the door has changed";
	if the true destination of the tardis exterior is gallifrey:
		now the true destination of the tardis exterior is earth;
	otherwise if the true destination of the tardis exterior is earth:
		now the true destination of the tardis exterior is gallifrey;
	
Test me with "n/s/xyzzy/n/s"
1 Like

That’s a clever way of solving the problem, and I guess there’s not much of an alternative without trying to redesign the entire concept of doors in I7. Thanks, I’ll give it a try!

Edit: I did give it a try, and it worked perfectly. (In my particular case, I could simplify it a bit by replacing the endless void with one of the destinations.) There might be some sort of unwanted interaction if a rule happens to intervene between actually going through the door and the After going through a magic door routine (or is it guaranteed to be atomic), but seems fine for now. Thanks!

1 Like