+1 vote
by (2.2k points)

I really like the idea that some random variable is changed every time you play. Like someone's name or a random number for the story, but I can't find an either macro for sugarcube and I'm wonder if it even exists. I know in harlowe you can do

(set: $var to (either: "a", "b", "c"))

And depending on your play through the variable could be any one of the three randomly.

Is there such a thing in sugarcube and if so, how do I use it? Or is there some other way to get these same results?

1 Answer

+1 vote
by (63.1k points)
selected by
Best answer

SugarCube has an either function, rather than a macro. 

<<set $var to either("a", "b", "c")>>

Macros in SugarCube can't be nested inside each other, but you can use functions to achieve similar results. 

by (1.7k points)

edit: beat me to it, so setting this as a comment instead ;)

You can do the same thing in Sugarcube, yep!

<<set $choice to either('x' or 'y')>>

Have you looked at Sugarcube's big list of macros by the way? I have it favorited for constant consultation because I'm always forgetting the exact punctuation of things.


by (2.2k points)
ha! I knew I should have looked harder! thanks for helping.
by (158k points)

either() can be found in the Functions documentation.

Welcome to Twine Q&A, where you can ask questions and receive answers from other members of the community.

You can also find hints and information on Twine on the official wiki and the old forums archive.

See a spam question? Flag it instead of downvoting. A question flagged enough times will automatically be hidden while moderators review it.