how do I print a message on the Xth turn in inform 7?

+1 vote
132 views
asked Mar 29 in Authoring by anonymous
edited Apr 14 by Juhana

I tried something like:

When play begins:
    say "a strange noise is coming from the kitchen." in 1 turn from now. 
    [should be the turn after the first command]

but it doesn't compile. Also how could I incorporate this into the above, but 2 turns from the beginning?

Every turn if the kitchen is unvisited:
    say "the unidentified noise is still coming from the kitchen."

3 Answers

+2 votes
answered Mar 29 by bg (692 points)
edited Apr 1 by bg

As far as I know, "N turns from now" only works with a named event (see §9.11: Future events in the Writing with Inform documentation). Here's one way you could do it.

(Note: From the question, it sounds like you want the message to show between the player's first command and the player's second command. If that's not the case, you can just change the "0" to a different number.)

When play begins:
    First strange noise happens in 0 turns from now.

Noise-Heard is a truth state which varies. Noise-Heard is false.

At the time when first strange noise happens:
    Say "A strange noise is coming from the kitchen.";
    Now Noise-Heard is true.

Every turn when Noise-Heard is true and the kitchen is unvisited:
    Say "The unidentified noise is still coming from the kitchen."

It seems like there ought to be a more straightforward way to make something happen on turn 1, though. If so, I hope someone will chime in and suggest one.

0 votes
answered Apr 13 by ChrisC (1 point)

This works, but the simplest and most extensible way is probably to use text substitutions. Chapter 5, especially §5.7. Text with random alternatives, is useful here.

To accomplish both your goals, I would wrap all the messages about the noise into a single say statement, using the [one of]...[stopping] construction to separate them.

Every turn when the kitchen is unvisited: 
    say "[one of]A strange noise is coming from the kitchen[or]The unidentified noise is still coming from the kitchen[stopping]."
0 votes
answered Apr 14 by Juhana (246 points)

You can use an internal counter called "turn count" which is automatically incremented every turn.

Every turn when the kitchen is unvisited and the turn count is 2:
    say "the unidentified noise is still coming from the kitchen."
This site is now closed.
As of 1st November 2015, this site is a read-only archive. For more information see the intfiction forum post

Welcome to IF Answers, a site for questions and answers about Interactive Fiction.

Technical questions about interactive fiction development tools such as Inform, Twine, Quest, QuestKit, Squiffy, Adrift, TADS etc. are all on-topic here.

Non-technical questions about interactive fiction are also on-topic. These questions could be about general IF design, specific games, entering the IF Comp etc.
...