Login
Remember
IF Answers
Ask a Question

# 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."

- inform7

## 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."

## Related questions

- How do I print two distinct objects from a list (Inform 7) in a description?
- How do I print a Help message after the game is restored?
- How to get rid of a rule that's blocking what I want the player to do? (Inform 7)
- How do I make a new action in Inform 7?
- When using hyperlinks, how do you make the command appear appear next to the > instead of on the following line? (Inform 7)

...