moving between different eras in the game

I am developing a game where I want to move between the present and past. In the game this is conveyed by changes in the room descriptions. What I would like is to be able to have all the room descriptions change on completion of a certain puzzle. The player may then visit the same rooms as before, but now they are described as they look 100 years ago, rather than in the present.

I have one way to do this that seems a bit messy:

Hardy Street is a room. "Description goes here".
A clock is a thing in Hardy Street. 
Instead of examining the clock:
	say "Your mind begins to wander. Soon you notice a change in your surroundings.";
	now the description of Hardy Street is "Hardy Street in the past";
	now the printed name of Hardy Street is "Hardy Street in the past".

Another way I have approached this is to create a value that varies.

Era is a kind of value. Eras are past and present. 
The current era is an era that varies. Current era is present.

If the current era is past:
   the description of Hardy Street is "Hardy Street in the past";
   now the printed name of Hardy Street is "Hardy Street in the past".

This seems nicer, but the above code example does not work.

Any suggestions?

That’s because “If the current era is past” by itself does nothing. It’s not triggering, because Inform doesn’t know WHEN it should trigger.

The closest thing to what you’re doing is “Every turn when the current era is past”, but don’t do that. It’ll keep checking and it’ll keep triggering.

There’s a bunch of ways to achieve what you want (I7’s so flexible! You can have a scene trigger, watch for a boolean variable, just lump all the changes in the bit in the code where the time warp happens, have text substitutions in the descriptions instead of manually changing them…), others will tell you the best way (my way would be convoluted, because that’s how I code and why I don’t do much of it), I just wanted to explain why your second example won’t work. Maybe that’ll be enough for you to find your best solution yourself. :slight_smile:

Probably the thing that’s closest to your code is to use text substitutions; see sections 5.1 and 5.6 of the documentation included with Inform (chapter 5 on the whole is a good thing to read). The idea is that you put the conditional inside the description and printed name. Like this:

The description of Hardy Street is "Here's some stuff that's the same about Hardy Street no matter what era it is. [if the current era is the past]Here's some stuff that only applies in the past[otherwise]Here's some stuff that only applies in the present[end if]." The printed name of Hardy Street is "Hardy Street[if the current era is the past] in the past[end if]".

The reason for the odd placement of the period in the description is that Inform often checks whether a period has been printed at the end of something that it has been said in order to figure out whether to throw in a line break, and often if the thing just before a text substitution (one of those bracketed thingies in the quotes) is a period it will throw in an unwanted line break. So it’s good to end your text substitution just before the line break if possible.

But, as Peter said, there are lots of ways to do this. My coding style also tends to be pretty convoluted so I won’t advise you which one to try!

There’s also the solution of creating two separate sets of rooms and moving the player from one to the other when they time travel.

One consequence of this approach is that, if the player drops an object in the past, it won’t be in the corresponding room when they return to the present, and, if the player drops an object in the present, it won’t be in the corresponding room when they travel to the past. The former might be good or bad depending on the story, while the latter is probably good.

Thank you to everyone for the help. It works great! Here is a minimum working example.

Era is a kind of value. Eras are past and present. The current era is an era that varies.
Current era is present.

The studio is a room. "You find yourself in a sunny studio. [if the current era is the past] In the past[otherwise] In the present[end if]."
The time machine is a thing in the studio.
Instead of examining the time machine:
	say "You feel your mind drifting...";
	now the current era is the past.

Transcript: