sugarcube 2 either macro like in harlowe?

+1 vote
asked Aug 12 by AnoeticDuckling (1,930 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
answered Aug 12 by Chapel (33,780 points)
selected Aug 12 by AnoeticDuckling
 
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. 

commented Aug 12 by litrouke (1,610 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.

 

commented Aug 12 by AnoeticDuckling (1,930 points)
ha! I knew I should have looked harder! thanks for helping.
commented Aug 12 by greyelf (42,750 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.
...