Howdy, Stranger!

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

endif in 2.0?

What happened to endif: in Twine2? I'm trying to have two different displays depending on whether or not you have a key.

(if: $key is "yes")blah blah
(if: $key is "no")blah blah blah

It shows both "blah blah" and "blah blah blah" regardless of whether or not you have the key.

In other news, Twine2 makes me grumpy.

Comments

  • You need to state which Story Format you are using when you ask a question, as answers can be different for each one. Based on the macro syntax of your example I am going to assume you are using Harlowe.
    Also please use the C button in the Comment field's toolbar to wrap your code examples in code tags, it makes them easier to find and read.

    Each Story Format is responsible for defining all the features it has, one of these features is the syntax of it's macro language (if it has one).
    Tildy wrote: »
    I'm trying to have two different displays depending on whether or not you have a key.
    If you read the Harlowe Manual you will see that its macro language uses a hook to contain the code associated to a macro. If you look at the (if:) macro's examples you will see that your examples should be formatted something like the following:
    (if: $key is "yes")[blah blah]
    (if: $key is "no")[blah blah blah]
    
    or if the $key variable can only contain the values "yes" and "no"
    (if: $key is "yes")[blah blah]
    (else:)[blah blah blah]
    
    ... You could also use a Boolean variable (one that can be only true or false) to do what you want, if you did the above example would look like the following:
    (if: $key)[blah blah, the $key variable contains a value of true]
    (if: not $key)[blah blah blah, the $key variable contains a value of false]
    
    or simply...
    (if: $key)[blah blah]
    (else:)[blah blah blah]
    

    Tildy wrote: »
    In other news, Twine2 makes me grumpy.
    Twine 2 is not a progressive upgrade of Twine 1, it is just another application (written using different programing languages) which can also be used to create Twine Story HTML files.
    There are only two reasons you have to use Twine 2 instead of Twine 1:

    1. You want to be able to edit your story on an operating system that has limited or no support of Python, like those found on mobile devices.

    2. You want to use the Harlowe Story Format, which is only available in Twine 2.
Sign In or Register to comment.