Implementing an Elevator

I have an elevator that needs to be able to move up or down to three different floors. Unfortunately, the Dubai example in the Docs is not applicable here, because that example assumes the only way to travel between floors is via the elevator. I also have stairways. It’s more than likely that the player will climb the stairs to an upper level and then want to press the elevator call button in order to bring the elevator up to the current location, after which the elevator will need to travel down to a different location at which the player can disembark.

The problem is with the doors. Doors in Inform are fixed, right? They can’t be shuffled around. But sometimes the elevator’s interior door leads to an upper room, sometimes to a lower room – and the outer doors of the rooms where the elevator isn’t must remain closed (and not openable) except when the elevator is at that floor.

Emily Short’s Deluxe Doors extension doesn’t work either, at least not in my experiments. I don’t seem to be able to alter the half-door of the elevator-interior-door, nor to alter the through property (the destination) of the elevator-interior-door.

I’m aiming at realism here, at least to a modest extent. I do need the exterior doors to open and shut (although in fact the elevator-interior-door can always be open, because whenever you’re in the elevator it will always be open to some floor or another). At a bare minimum, I would like to write code like this: “now the elevator door is east of the elevator and west of the Third Floor Lobby.” But I’m pretty sure that’s not allowed.

So how do I do it?

See WWI 8.5 Change of properties with values. There is a special phrase for rearranging room connections.

EDIT: Oops. I misread your desired statement as being about rooms, not doors – even while quoting it! Sorry about that.

EDIT 2: I was inspired by CrocMiam’s recent implementation of something “impossible” (creation of a way to sort lists by calculated values) on another thread, so I finally put together a working prototype of an extension to allow doors (yes, real actual regular I7 doors!) to be moved around the map at will.

It turns out that this is significantly less useful in practice than Easy Doors. So anyone who feels like the inability to move doors around is a shortcoming should probably just use that extension instead.

1 Like

Can you just fake the elevator door instead of using an Inform door? I recently learned the power of faking doors and now I never use the built-in ones anymore.

You could have a fake inside-elevator door and a fake outside elevator door that moves when the player pushes a button in the elevator.

4 Likes

Good try, but that’s not going to work. According to the text on that very page, 8.5, “Note that connections can be made to rooms, but not doors: the positions of doors are fixed.” Since I need the exterior elevator doors to open and close appropriately, it’s not enough to change the destination of the room direction.

Off the top of my head without my computer in front of me: I would try making a separate room for each level of the elevator and move the player between those rooms.

I haven’t used it myself, but I believe @hanon’s Easy Doors extension is useful for cases like this.

2 Likes

You’d have to handle the player dropping an item inside the elevator. If the player then goes to the elevator on a different floor (by stairs), the dropped item won’t be there.

I too would try Easy Doors in this case.

Thanks – that seems to be working well. Now all I need to do is intercept the default “You can’t go that way” when the player tries to go in the direction of a closed elevator door. Should be a piece of cake, or at least a nibble of doughnut.

3 Likes

When I first started dabbling in creating IF (still in WIP mode…) , this was something I had trouble getting my head around. The things you tell the player are there, the nouns and stuff in the descriptions, aren’t really there.

As long as the surface, the text presented to the player, responds naturally, it doesn’t matter what’s under the hood.

Of course using the inbuilt behaviour of the If-creation system of your choice for dealing with keys and doors and tables and closets is handy, but still, there’s nothing really there but code.

3 Likes

Exactly. From the very beginning (more than 20 years ago…) I’ve found it useful to envision scenery objects in a room as actually being suspended in space. What the player is told may have little to do with what’s actually going on, but as long as the impression that the text gives is seamless, the player need not know or care.

3 Likes

I felt absolutely god-like when I realized I didn’t have to put up with baked-in Inform crap, like unmovable doors. Now when I have problems with any standard Inform thing, I see if I can fake it instead. I actually think it often makes for a better player experience, because you can control everything that happens to it without worrying about under-the-hood behavior you don’t know about.

5 Likes

I had been thinking “Couldn’t you just have three different elevator cars pretending to be one?” like @rileypb suggested above and took a stab at a proof of concept and came to the conclusions:

  • no, it’s a pain to do it that way
  • actually, elevators seem to be a pain in general
1 Like

Someone mentioned the “Easy Doors” extension above. That’s what I would use, but I guess I’m a bit biased…

You’d make a separate room that is the elevator. On each separate floor you use an easy door that “leads to” the elevator (narrating that you push the button and the car arrives…when then player enters).

[EDIT:] Since you can move easy doors, you can move the exterior door on and off in the elevator lobby if desired saying “the elevator arrives”…

Inside the elevator you have an easy door that changes where it leads to based on what button is pressed.

This can be done manually like @AmandaB said by just making your own “door-like” enterable objects but that’s exactly what we made that extension for.

5 Likes

Ah, well. I’ve already done it her way, but I may go back later and try optimizing the code using your extension. Thanks!

1 Like

if the elevator is a roughly post-1950s automatic elevator, whose has also automatic door, perhaps the best solution is along a line about doors closing & opening and appropriate change the exit… the same thing applies to pre-1920/30s manual elevator, moving floors via commands to the elevator valet (whose can also allows a “convince the valet that you’re authorised to certain floor(s)” variation of the classical guard puzzle, whose can be solved with social engineering instead of badges/IDs)

The real PITA remains all those automatic elevators with manual doors (still relatively common in old buildings here in EU…) whose need open/close, but one can render implicit the closing/opening of (fake) door (again, the say/change handling I suggest)

Best regards from Italy,
dott. Piergiorgio.

Yes, if you want to be generous to your players, you can also make the elevator trivial to use:

Instead of going up in the Lobby:
    if the south exit of the Elevator is not the Lobby:
        say "(first summoning the elevator)[command clarification break]";
        silently try pushing the elevator button;
    if the south exit of the Elevator is the Lobby, try going north;
    if the location is the Elevator, try pushing the second-floor button;
    if the location is the Elevator and the south exit of the Elevator is the Second Floor, try going south.

Or if you want to make it easier on yourself, too, you can just implement up and down exits from each floor and add some descriptive text about using the elevator.