Howdy, Stranger!

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

SugarCube either function broken?

FIFFIF
edited January 2017 in Help! with 2.0
I've been trying to use the either function in my port from Harlowe to Sugarcube to no avail. I've pasted the code directly from the manual:
either("Blueberry", "Cherry", "Pecan")

My output is: either("Blueberry", "Cherry", "Pecan")

Is this function available at this time?

Comments

  • edited January 2017
    You have to store the value somewhere.
    <<set $pievariable to either("Blueberry", "Cherry", "Pecan")>>
    
  • Ahhhhhh. There we go. Different from Harlowe. Thank you.
  • FIF wrote: »
    I've been trying to use the either function in my port from Harlowe to Sugarcube to no avail. […] Is this function available at this time?
    It's generally frowned upon to post the same question in multiple threads. I answered you in the obsolete Workaround for SugarCube not supporting either()? thread, however, I'll repeat myself here.

    If you're try to print the selected text, then you need to use <<print>>. For example:
    <<print either("A", "B", "C")>>
    
    Using your given code: (w/ line-breaks and indention for readability)
    <<print either(
    	"great job being honest most of the time. I'm proud of you.",
    	"great job being so honest. You must drink a lot of honest tea.",
    	"we think people who are honest are cuties. Great job today.",
    	"it's a great feeling when you do the right thing and are honest as you do it. So, we commend you for doing just that.",
    	"we know it's not easy going room the tasty alien zombie apocalypse and being honest the entire time. But somehow you managed to do that! Very impressive.",
    	"honesty isn't just the best policy, it is the only policy you live by. Impressive!"
    )>>
    


    You have to store the value somewhere.
    <<set $pievariable to either("Blueberry", "Cherry", "Pecan")>>
    
    That's not quite correct. If you merely need to use the returned value immediately, then you can simply do that. You only need to store it in a variable if you want to keep it around.

  • Thank you. Sorry, I won't do that again.


  • You have to store the value somewhere.
    <<set $pievariable to either("Blueberry", "Cherry", "Pecan")>>
    
    That's not quite correct. If you merely need to use the returned value immediately, then you can simply do that. You only need to store it in a variable if you want to keep it around.

    [/quote]

    Oh I see, thanks.
Sign In or Register to comment.