Login
Remember
IF Answers
Ask a Question

# Is there an easy way to loop text in Inform 7?

0 votes
97 views
asked Sep 3 in Authoring by anonymous

I feel like there must be some simple method and I'm missing it (as usual). What I want is something like this:

Grazing is an action applying to nothing.
Understand "graze" as grazing.
Instead of grazing, say "You eat an onion." then "You nibble a carrot." then "You consume a turnip." then "You chomp a bagel."

I know the programming syntax would look nothing like that, but I wrote it like that to convey the idea. After "You chomp a bagel." is displayed, then it should loop back and say "You eat an onion." and continue to loop indefinitely whenever the player uses the "graze" command. In that specific order: onion, carrot, turnip, bagel. Over and over.

- inform7
- loop
- repeat

## 1 Answer

+2 votes
answered Sep 3 by bg (692 points)

For that you use "[one of]," "[or]," and "[cycling]."

From §5.7. Text with random alternatives, here's an example:

    say "The pundits discuss [one of]the weather[or]world events[or]celebrity gossip[cycling]."

## Related questions

- Is there an easy way to port Inform 6 code (unfinished game) into Inform 7 to continue development?
- With Flexible Windows by Jon Ingold, is there a way to make the text display at the top of the window, even in Gargoyle? (Inform 7)
- Is there a way to reduce the right margin for a play-in-browser website released by Inform 7?
- In Inform 7, is there a way to detect which interpreter is being used?
- What's the best way to test whether or not scoring is being used? (Inform 7)

...