Need help with changing a room description

hi there. just got started today, i’m trying to write a short story based on some material i already have, just to get my feet wet. I’m trying to print a block of introductory text, but putting “say” at the beginning of the game instead of the room leads to an error where it doesn’t know the verb i’m trying to use; and if i put the room first, it always prints its description. I figured an easy solution would be to just have the room description be my intro blurb, and then just immediately changing the room’s description for the purpose of the player looking. I was trying to do this via the method shown in 3.1 of the recipe book, but it gets confused as to what I’m doing. as far as i can tell the syntax of the actual code i’m using matches the stuff in the documentation and example projects, but clearly I must be doing something wrong?


2 Likes

Welcome to the forum! If all you want to do is print some text when the game begins, you can use a “when play begins” rule. That looks like this:

when play begins:
	say "the thing you want to say.".

You have the right syntax for changing a room description, but that has to happen in the course of action processing. In other words, it has to be tied to an action of some kind. For instance:

after looking for the first time:
	now the description of the Maintenance Platform is "the new description.".

You can also have one description that varies based on conditions, as in

the description of the Maintenance Platform is "[one of]This will print the first time only.[or]This will print every time afterwards.[stopping]"

I know this is a lot to look at. The first suggestion, “when play begins,” sounds the closest to your original intent and is used in a lot of games. You can read about the start of a game here:

WI 9. Time (zedlopez.github.io)

4 Likes

hey, that seems to have gotten my code running. now my only issue is that this text goes even before the title and author heading. any way to rearrange that?

If you want it after the banner but before the bolded name of the starting room:

Before looking for the first time:
	say "intro.".

After the bolded name of the room (as if part of the room description), I’d go with

The description of the demo room is "[first time]Here you are; it's your first day in the demo room. 

[only]This is a small, unfurnished space used for demonstration purposes."

Inform has a lot of ways to vary text (as in [one of] and [first time]). They’re all discussed here.

2 Likes

thanks!

I just want to add something here as a matter of clarification, because this is something that comes up frequently with Inform (7). Phrases (as described in chapter 11 of the documentation) can sometimes exist on their own, where they begin with “To…:” Most of them, however, such as:

now the description of the Maintenance Platform is "the new description."

need to exist within a rule (or a “To” phrase). This is often confusing for new users. One way to aid you in determining when this applies is an (I believe) undocumented convention of the documentation itself. If you see a sentence which begins with a capital letter, such as:

When Train Stop begins:

or

To admire (item - an object):

it can begin its own code block. If it begins with a lowercase letter, as in:

now the rat is in the cellar;
say "Boo!";
if the score is less than 10:

it needs to be contained within a valid block of code.

Note that this is merely a helpful stylistic convention of the docs and is not necessary in practice. In general, capitalization outside of quoted material in Inform code is irrelevant. (As you can see, @kamineko doesn’t follow this convention in the examples given and his code works fine.)

2 Likes