User Tools

Site Tools


either(value, value, ...)

Give the either() function several string or number values, separated by commas, and it will pick one of them randomly. This allows a good degree of randomness to be inserted into the story, while still being fairly readable.

You can use either() with <<print>> to print a random message or phrase…

"I sentence you to be buried alive in <<print either("rhinoceros","buffalo","triceratops")>>
<<print either("vomit", "sweat", "snot")>>!" the JudgeBot crackles noisily.

…or with <<display>> to display one of a set of passages.

You can also use either() with <<set>> to set variables to random values:

<<set $playerMoxie to either(2, 4, 6)>>
<<set $playerAttire to either("green", "black", "rainbow")>>
You have <<print $playerMoxie>> moxie points, and <<print $playerAttire>> armour.

And, in addition to macros, you can use either() with the link syntax to make a link that goes to a random passage:

You plunge into the [[glowing vortex|either("12000 BC","The Future","2AM Yesterday")]].
twine1/either.txt · Last modified: 2017/08/19 17:04 by videlais