This is a very short script that allows you to use a function called "either" in Twine's <<set>>, <<print>> and <<if>> macros. Give it several string or number values, separated by commas, and it will pick one of them randomly to use in the macro.
window.either = function() { return arguments[~~(Math.random()*arguments.length)];}
This functions largely identically to the Game Maker choose()
function. You can use it like this:
<>
- Prints one of the strings, chosen randomly.
<>
- Sets $value to one of the numbers.
<>
- This is true 50% of the time. Equivalent to <>
It's functionally similar to the <<rnd>> macro, but can be used inside <<set>> as well as <<print>>.
Feel free to report any bugs to @webbedspace.