Changing room descriptions based on whether player has entered room before?

Hi all! I’m very new to the Inform, working on my first little game. Finding Inform after years and years of wishing something like this existed is a dream come true! Anyways: I’m trying to have multiple descriptions for rooms that are triggered based on whether or not you’ve been to the room before. In my game, the player wakes up in a mysterious location and asks himself some questions: “Where am I, how did I get here, etc.”

Now, when he travels north or south, he gets to the next room and all is hunky dory but if he returns to the starting location (a necessary backtrack in the plot) The description is the same ‘game start’ text, where he wakes up and asks himself the questions. These backtracks are common through the game, and the narrative is progressed in part by expository events and internal monologues that pop up as a new location is reached for the first time. It really disrupts the flow of the game if these events and monologues appear to repeat every time he walks into a room.

My apologies if this is a common question, I did some searches for ‘new room descriptions’ and a few other things, and wasn’t able to find anything in the forum. If anyone knows a work-around for this, or some recipes in the documentation I could use for reference of this sort of thing, I’d be very grateful.

1 Like

I managed to turn up the “Slightly Wrong” example which uses [if unvisited]...[end if] in the room description. I think that should do what you want?

But yeah, everybody seems to struggle with finding stuff in the documentation, especially at first. There’s a lot of it, and some of it is more than a little bit strangely organized. :slight_smile: And how do you even know what to call things?


This sounds more like a “when play begins” routine rather than a room description. (Where things go in a game, and where to find them in the documentation comes more from trying out the example code, and searching – I use Google and say something like “Inform 7 room description” which almost always turns up the right page(s) in the online documentation.)

Anyway, you say the game starts with the player in a mysterious location and the player asks himself questions. How does the player know what questions to ask? How will the game answer the questions? If this is just the introductory text then a simpler solution is something like this:

When play begins:
	say "[bold type]Where am I?[roman type][paragraph break]You are in a mysterious location.[paragraph break]";
	say "[bold type]How did I get here?[roman type][paragraph break]Mysterious forces brought you here.[paragraph break]";
	say "[bold type]What am I supposed to do?[roman type][paragraph break]Take a look around and see if you can figure out why you're here and how you can get back. (Hint: Clicking your heels and saying 'There's no place like home' three times is not it.)[paragraph break]";

With this, the text is displayed when the game starts and is never shown again. However, “when play begins” happens before the banner text is displayed. If you want it after the banner text, you would use “After printing the banner text”.


Thanks to you both, Josh and AJ, I think these two answers together provide exactly what I’m looking for! it’s a shame they don’t let me tag both as solutions.

For more complex revelations, you may also want to look at “How Many Times?” and the Infiltration example.

If the player is in the Ballroom for more than the third time …
if the player has been in the Ballroom exactly three times …

You can also change the description in one room based on checking whether another room is visited. So, if the player has visited Room A, the description in Room B could change to note that a similar object “looks familiar.”

1 Like