It looks like you're new here. If you want to get involved, click one of these buttons!
[[It's road trip time.|Intro]] (set:$n to 0) (set:$passages to 4) (set:$passage to "1")Intro Passage:
The car rumbles and you look out the [window.]<DisplayNext| (click: ?DisplayNext)[(set: $n to $n+1)(set:$passage to (text:(random:1,$passages)))(display: $passage) [[What else?|Intro]]]I have a number of passages titled with the numbers 1-4 that can be displayed here.
Comments
I think the end result you are describing is one where the Reader can click on the same link multiple times and each time they do so the contents of a random child passage is displayed to them. If this is what you want then use one of the following two solutions depending on if you want the Reader to be able to use the Undo button to revisit previously shown random passages.
1. Reader can't see previous randomly displayed passages:
This solution uses a (link-repeat: ) macro, a (replace: ) macro and a named hook to achieve the required effect. The solution modifies your existing Intro passage and adds a child passage (named Random Scene) to store the logic code so that the Intro passage does not become messy.
a. Intro passage: b. Random Scene passage: note: You will need to add extra line-breaks to the end of the content of the 1 to 4 passages so that a gap appears between their content and the "The car rumbles and you look out..." text of the Intro passage.
2. Reader can see previous randomly displayed passages:
This solution use an (unless: ) macro to conditional show the contents of one of the 1 to 4 passages. The solution modifies your Start passage, your Intro passage and adds a child passage (named Random Scene) to store the logic code so that the Intro passage does not become messy.
a. Start passage: change the default value of the $passage variable. b. Intro passage: c. Random Scene passage: note: You will need to add extra line-breaks to the end of the content of the 1 to 4 passages so that a gap appears between their content and the "The car rumbles and you look out..." text of the Intro passage.