Elevator Movement

I am just learning to use Inform 7 and want to have the player enter an elevator. I have created several rooms - one for each floor of the elevator. If the player gets on the elevator at floor 3 I want him/her to just type something like “floor 12” and have him/her moved to floor 12. And I want this to work for every floor of the same elevator.

Is this possible, or am I asking for way too much coding?

Thanks.

It can be done without too much effort. The Dubai example is a bit elaborate, while this example shows how to basically move a room on demand.

Thank you. I will read over that code and see if I can adapt it.

If I read your post correctly, you have ave created rooms “elevator level 1”, “elevator level 2”, and so on? I would definitely not do that: the elevator is just one room, and you want to have Inform model it as such. (If the player drops something in the elevator and then moves to a different floor, it shouldn’t disappear!)

What you probably want is:

  • One room called “Elevator”.
  • A number that varies, which keeps track of the floor the elevator is supposed to be on.
  • A rule that moves the player to the appropriate floor on exiting the elevator.

Instead of exiting when the location is the elevator:
if the elevator level is 1:
move the player to Floor 1;
if the elevator level is 2:

and so on. (Untested code, I don’t have Inform on this PC.)