Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

random goto (Sugarcube 2)

One easy thing for a programmer.
One difficult thing for me. I would like to make a random goto.

I tried this one, but it doesn't work:
<<goto either("kitchen", "garden", "cellar")>>
(This way twine wants to send me to a passage called "either". )

Help me, please!

Comments

  • The <<goto>> macro does not natively accept expressions, which is what you're attempting to do there.

    You'll need to use either a temporary variable or a backtick expression (see: Passing an expression as an argument, near the top) to pass the result of the either() function.

    For example:
    /* Using a temporary variable */
    <<set _where to either("kitchen", "garden", "cellar")>><<goto _where>>
    
    /* Using a backtick expression */
    <<goto `either("kitchen", "garden", "cellar")`>>
    


    Beyond that, if you're using the <<goto>> within a <<link>> macro, then you don't need it in the first place as <<link>> natively offers the ability to forward the player to a passage—no <<goto>> needed.
  • Thank you! That helps! :)
Sign In or Register to comment.