Howdy, Stranger!

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

How to create a checklist and condition

edited October 2015 in Help! with 2.0
Hi, i'm a very young game writer and i'm trying to write an objective base type where you need to do a check list where you and your group of survivalist had created lots of items. It's a dialogue based game where you answer yes and no to your members and see which one is needed to craft and which one didn't.

I want my twine to do a checking path were if one item and another item had been created, then the next branch of dialogue will appear

Also to add, i'm a very very bad programmer. And had low knowledge in terms of basic programming, so an easy side tutorial onto my problems would also be a bonus to me

Comments

  • edited October 2015
    This sounds like it can be easily done with a few variables.

    Let's say you want to combine a rag and a stick to make a torch that you already have.

    <<if $stick is true>>
    <<if $rag is true>>
    "Hey, I can make a torch out of these tools."
    Make Torch
    <</if>>
    <</if>>

    Then in the Make Torch passage
    <<set $torch to true>>
    <<set $rag to false>>
    <<set $stick to false>>

    And back to the main story passage...
    <<if $torch is true>>
    "Alright, now I can explore this dark cave that I wasn't able to before."
    Continue with the story
    <</if>>

    Would something be that be what you're looking for?

    EDIT: It's also important to note the codes I've used in this example are for Sugarcube. If you're using Harlowe or Snowman, I understand those use different syntax, meaning my examples won't work very well with those formats.
  • <<if $stick is true>>
    When checking (comparing) the value of a boolean variable, which is one that has a value of either true or false, you don't need to use the is keyword. You can also comparing the value of more than one variable in a single <<if>> macro but using the and & or keywords.

    So the above example could be written like either:
    <<if $stick>>
    <<if $rag>>
    "Hey, I can make a torch out of these tools."
    [[Make Torch]]
    <</if>>
    <</if>>
    
    .... or you could compare both variables at the same time like so:
    <<if $stick and $rag>>
    "Hey, I can make a torch out of these tools."
    [[Make Torch]]
    <</if>>
    

    The Harlowe equivalent of the above would be:
    (if: $stick and $rag)[
    "Hey, I can make a torch out of these tools."
    [[Make Torch]]
    ]
    
Sign In or Register to comment.