Quantcast
Channel: Twine Forum
Viewing all articles
Browse latest Browse all 3830

Displaying part of a random passage on click

$
0
0
Twine 1.4 and SugarCube 2.

Let's say I have a simple passage like this:
Some text and <<click "button">><</click>>.

When the button is clicked I want to: get a random passage from a list, then get a random sentence from that passage, and display it below the original text and button--with any links removed/deactivated (so only showing plain text sentence). So the player can keep clicking the button, and new random sentences will keep appearing below it.

I know I can display a random passage with:
<<set $passage to either("Passage 1", "Passage 2", "Passage 3")>>
<<display $passage>>

And I thought I could display a random passage on button click with something like this:
<<click "Show Random">><<set $passage to either("Passage 1", "Passage 2", "Passage 3")>><<display $passage>><</click>>

But that's not working.

As for grabbing a random sentence from the passage (rather than displaying the whole passage), and deactivating the links... I assume this is something I should try to do in prerender, via some kind of black magic vaguely like this?

Viewing all articles
Browse latest Browse all 3830

Trending Articles