I7 - Varying descriptions based on scene

So, in my current project I have a few locations that don’t really change through time. One of them is a region of rooms that is the start of each ‘day’ of the game. Part of the narrative is that you start off in the same room every day.

I’d like to vary the descriptions of the room and scenery a little as days progress, is it possible to do this in a structured manner? I realize I can just ‘say’ different things in response to certain actions based on the scene but that doesn’t seem like a very nice approach. I’m hoping for something along the lines of:

Act 2 is a scene. During scene 2 the description of the briefing room is…

Essentially I’d like to keep all my descriptions together with the scenes if possible, or at least to avoid large amounts of text with [if during…] at the ‘top’.

Maybe this is also an ‘overall structure’ question rather than a technical question.

Thanks!

The room description rules is an object based rulebook with default success.
To say room-desc: follow the room description rules for the location.

The Briefing Room is a room. The description is "[room-desc]".

Act 2 is a scene. 
Act 2 begins when the player holds the ticket.

A room description rule for the Briefing Room: say "This is the ordinary description.[no line break]"

A room description rule for the Briefing Room during Act 2: say "Wow, this is so very different![no line break]"

The ticket is in the briefing room.

This could probably be done better, but I usually do it with a rulebook.

That seems a bit excessive. I’d just use a condition.

The description of the briefing room is "[if Act 1 is happening]Text text text[else if Act 2 is happening]more text..."

Yeah, I agree that would be the better solution. I interpreted the request for something “structured” to mean that TMM wanted something more.

Well, I’d like to have a way to have scene specific things only appear in the code of the scene itself and not have it all over the place.

Ideally I’d have default descriptions of all my rooms in a separate part, I do this now, and only in a particular scene if something needs to be a little different do I override it there. Maybe a new description printing rule is in order.

If you want the scene-specific descriptions to appear in the code for the scene, you could set them as properties for the scenes, and then have the room description call those properties.

So like this:

[code]A scene can be description-determining. A scene has some text called briefing-room-description.

Briefing Room is a room. The description of Briefing Room is “[if a description-determining scene is happening][briefing-room-description of a random happening description-determining scene][otherwise]It’s the briefing room.[end if]”

[and then in the code for the Meeting]

Meeting is a scene. Meeting is description-determining. The briefing-room-description of Meeting is “Here’s where the meeting is.”[/code]

We needed to use the “description-determining” property because more than one scene can be happening at once. (For instance, ‘Entire Game’ is a scene that’s always happening.) “Description-determining” lets us pick out scenes that actually affect the description. You’ll probably want to make sure that description-determining scenes can’t overlap–if only one is going on at a time then “a random…” will pick that one. (We can often use “a random foo” when we know that there will only ever be one foo, but Inform doesn’t–then it picks out the only foo. Always make sure there’s at least one before you do this, or you’ll get an error when the game is running.)

…really, though, I think Eleas’s solution is better. You can put the room description rules for given scenes in the scene machinery, and it lets you be more flexible–you only have to code the exceptions you want to. So if Act 2 varies the description of one room, and Act 3 varies the description of a bunch of rooms, with the rulebooks you can write a single rule for the room that act 2 changes and a bunch of rules for the rules act 3 changes. You don’t have to give any fancy properties to scenes to let Inform know that this scene changes things–you can just code the exceptions as they come up.

One thing about Eleas’s code is that “default success” means that when one rule runs the rulebook stops, unless you tell it to continue. That’s why you won’t get more than one description printing.

If this is what you want, here’s a refinement of the idea.

The room description rules is an object based rulebook with default success.
A room description rule: rule fails.

Carry out looking (this is the tweaked room description body text rule):
	if the visibility level count is 0:
		if set to abbreviated room descriptions, continue the action;
		if set to sometimes abbreviated	room descriptions and
			abbreviated form allowed is true and
			darkness witnessed is true,
			continue the action;
		begin the printing the description of a dark room activity;
		if handling the printing the description of a dark room activity:
			now the prior named object is nothing;
			say "[It] [are] pitch dark, and [we] [can't see] a thing." (A);
		end the printing the description of a dark room activity;
	otherwise if the visibility ceiling is the location:
		if set to abbreviated room descriptions, continue the action;
		if set to sometimes abbreviated	room descriptions and abbreviated form
			allowed is true and the location is visited, continue the action;
		follow the room description rules for the location;
		if rule failed, print the location's description;

The room description body text rule does nothing.
The tweaked room description body text rule is listed before the room description paragraphs about objects rule in the carry out looking rulebook.

The Briefing Room is a room. "This is the ordinary description."
The ticket is in the briefing room.

Act 2 is a scene. Act 2 begins when the player holds the ticket.
A room description rule for the Briefing Room during Act 2: say "Wow, this is so very different!"

Because it messes with the standard rules it’s more invasive, but what this does is this: as soon as you add a room description rule for a location, that rule will automatically print its text instead of the default body text (which is still the description).

If you want to separate the code but still do it the simple way:

When Act 2 begins: now the description of the Basement is "It's now Act 2 in the basement!".