Howdy, Stranger!

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

Can't get (else:) to work in Twine 2

Hi all
I'm just new to Twine, and I have searched for an answer to this, but just like my (else:), it returned nothing

My main passage includes
(set: $gun = "Yes")

A subsequent passage includes
(if: $gun is "Yes")[Bang](else:)[You don't have a gun]

This works fine, but if I change $gun to "No", it displays nothing

Comments

  • edited November 2015
    As a follow up.
    I found the following code as an answer to another question...
    (set: $item to "key")
    (set: $weapon to "crowbar")
    (if: $item is "key" and $weapon is "crowbar")[I have both required things]
    (elseif: $item is "key" or $weapon is "crowbar")[I have one of the required things]
    (else:)[I have none of the required things]
    

    When I Play it, it displays "I have both required things", but if I change the contents of $item or $crowbar, then it displays nothing. E.g. only the inital "if:" statement works
  • This is a known bug in the new 1.2 version of Harlow that came with Twine 2.0.9
  • Thank you, I have wasted a lot of time on this :'(
    It's a bit surprising, because 'if/else' is one of the most basic requirements. How do others get around it?
    Is there a list of know bugs that you know of?
  • Jimowens wrote: »
    ...because 'if/else' is one of the most basic requirements. How do others get around it?
    You could try using a series of (if:) macros instead of (else-if:) or (else:)
    (set: $gun to "No")
    
    (if: $gun is "Yes")[Bang]
    (if: $gun is not "Yes")[You don't have a gun]
    
    But that can become quite complex if you are testing multiple variables pre expression, the following example based on your second comment:
    (set: $item to "key")
    (set: $weapon to "crowbar")
    
    (if: $item is "key" and $weapon is "crowbar")[I have both required things]
    (if: ($item is "key" and $weapon is not "crowbar") or ($item is not "key" and $weapon is "crowbar"))[I have one of the required things]
    (if: $item is not "key" and $weapon is not "crowbar")[I have none of the required things]
    
    Or you could just use Twine 2.0.8 until a new version of Harlowe is released.
    Is there a list of know bugs that you know of?
    The Harlowe project does not allow the submitting of Issues so you can't look there, the only place I know of where you will find information about outstanding bugs is on this forum.
  • Thank you again. One of the above should solve my problem.
  • How do I download 2.0.8? I can find only 2.0.6
  • edited November 2015
    Jimowens wrote: »
    How do I download 2.0.8? I can find only 2.0.6
    The Twine project's downloads page.

    note: You may be able to use one of the Twine 2.0.9 pre releases (1,2,3), depending on exactly when the bug was introduced.
  • Thank you again greyelf
    twine_2.0.9pre3 works in this particular scenario
  • Might need to go earlier. The Pre3 version creates stories but then can't find them again :\
  • Went back to twine_2.0.9pre2. That seems to be working :-)
  • Twine 2.0.10 has been release which includes an updated version of Harlowe
  • Thank you, I will give it a go
Sign In or Register to comment.