Saying something on first entrance and then never again

Hi, all. Long-time player, first-time author, here.

I first tried this:

After going to the Example Room for the first time: say "foo."
But that would skip the room description altogether and just print “foo.”

Then I tried this:

Every turn: If the player is in the Example Room for the first time, say "foo."
But then, so long as the player is in the room for the first time, it continues printing “foo” after every action they perform while in the room.

Then I tried this:

Completeness is a kind of value. The completenesses are complete and incomplete. Conversation is a completeness that varies. Conversation is initially incomplete. Every turn: If the player is in the Example Room for the first time and Conversation is incomplete, say "foo."; Now Conversation is complete.
But then “foo” is never printed.

How would you accomplish this? Many thanks!

I figured out where the logic error is in the last example, but I don’t know the syntax to properly fix it. I assume it would be something like:

Completeness is a kind of value. The completenesses are complete and incomplete. Conversation is a completeness that varies. Conversation is initially incomplete. Every turn: If the player is in the Example Room for the first time and Conversation is incomplete, say "foo." and now Conversation is complete.
But that doesn’t work. Or maybe there’s a better way!

Good catch! If you want to have more than one line under the scope of an if-statement, the way to do that is to indent every line that’s supposed to be within the scope of the “if”. Like this:

Every turn: If the player is in the Example Room for the first time and Conversation is incomplete: say "foo."; Now Conversation is complete.

Everything that’s double-indented will only execute if the “if”-condition is true. If you had a single-indented line after that, it would execute whether or not the “if”-condition were true. See section 11.7 of Writing with Inform (which also gives you an alternative syntax with “begin” and “end”).

Also, it’s important to note that you have to use real tab stops for this to work. The code I typed above uses spaces, because I can’t type a tab stop in this browser, but Inform doesn’t recognize spaces as used for indentation–only tab stops.

Thanks!

Once you’ve got the conversation flag set up, you can drop the “for the first time” part. You don’t need both – the flag makes sure that message can only be printed once.

Or you can just append your room description with a “[first time]…[only]”

Test Room is a room. “This is the test room[first time], which you’ve never been in before[only].”

Brilliant! Very helpful community, it seems.

Your first version, with the After rule, will also work if you add “continue the action” to the end. Just make sure there’s no way for the player to try to go to the room and fail.

I will add the “Last report” solution that I was told when I asked the same question!