Howdy, Stranger!

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

Branching dialogue - disappearing choices

Very basic question on Harlowe.

In a story, player reaches six choices: three main ones which advance the story, three optional ones leading to additional info. I want each optional choice to display dialogue, and then return the player to those three main choices AND the unclicked optional choices. Essentially, how do I make optional choices disappear after they've been clicked on?

Comments

  • One way is to use variables to store which of the options choices have been chosen. If they're called choiceA, choiceB, choiceC, then you'd put this in a passage tagged 'startup'
    (set: $choiceA to false)
    (set: $choiceB to false)
    (set: $choiceC to false)
    

    Then in the passage with the choices you'd put:
    (unless: $choiceA)[ [[first optional choice]]]
    (unless: $choiceB)[ [[second optional choice]]]
    (unless: $choiceC)[ [[third optional choice]]]
    

    Then in the passage for the first optional choice add this
    (set: $choiceA to true)
    

    Adding similar lines in the other optional passages.
  • Thanks!

    Sadly it didn't quite work. Selecting from one of the three optional choices leads to a passage with dialogue, and 5 options (3 main, 2 optional), and from there selecting an optional choice leads back to a passage with the first "if" as clickable. I don't want that link to show.

    I also tried greyelf's answer in http://twinery.org/forum/discussion/4833/multiple-selections-in-if-statement#latest but with little more success. On the one hand I wasn't sure what (set: $history to (history:)) was nor where to put it. The other problem was what to put as code in the event the player is viewing the third and final optional choice (and therefore no longer having access to the other two - only the three main ones).

    I tried not writing anything between the brackets in this example:
    (if $history contains "Info dump 2" and $history contains "Info dump 3")[No more info dumps]

    ...but clearly that didn't work.

    Thanks... and apologies. No doubt I'm making a mess of your instructions.
  • If I'm reading it right, if you click on the first option, the passage you go to doesn't show the first option, but when you click on another option it reappears.
    Which suggests that the flag is being reset to false. So I'm wondering where you've put the code to set the three flags to false. It should be in a separate passage which is run before reaching the point where you have the optional choices. If you give that passage a tag of startup then it'll ensure that it only runs when the story is starting.

    The (history:) macro gives a list of all the passages the player has been to, so you check if the player has visited a particular passage. Using that macro can be quite slow so if you're going to check it more than once in a passage, it's best to store the result in a variable. Which is what
    (set: $history to (history:))
    
    does.
    You should put that line at the start of any passage that you want to examine the history.

    The test is missing a colon after the word 'if', it should be
    (if: $history contains "Info dump 2" and $history contains "Info dump 3")[No more info dumps]
    

    I don't know if that's just a copying error, but if not that'll be why it's not working.
  • Hey prof,

    I've tried it your way again. I set up the code for the three flags to false a couple passages before the one in question, tagging it as startup. Oddly, it duplicates the contents of that initial passage (while further down the line not tracking which optional choices were visited by the player).

    At this point I'm not sure what I'm doing wrong.

    Gotta thank you for your resilience in the face of my ignorance.
  • I wasn't clear enough about the tagging.
    The point of tagging a passage with 'startup' is that passage will be run before the story starts. So if you tag one of the regular passages with startup then you'll see the text from it at the start and again when the player visits that passage. What you should do is create a new passage, tagged 'startup' which just sets all the variables that you use.

    Aside from that, would it be possible to attach a copy of your game? That'd make it easier to see what's going wrong.
  • Here is a very basic skeleton.
  • The problem is you're repeating the list of links in each of the optional passages, but you're only checking the value of the flags in the "you're keeling" passage, which you never go back to.
    Another issue with repeating the links is, if you want to change one of the links you need to change it in every passage.

    A better way would be to have a passage called something like 'choices'
    [[You're hired!]] 
    [[Can I taste something?]]
    [[Not interested]]
    (unless: $choiceA)[ [[How did you become chef?]]]
    (unless: $choiceB)[ [[Tastes aboard]]]
    (unless: $choiceC)[ [[Sous-chef Max]]]
    

    Then in every passage where you want to show the list of choices add
    (display: "choices")
    
    Making sure to put it after the line where the flag is set to true. I've attached an edited version that shows what I mean.
  • I see where I went wrong. Makes sense.

    Thanks again so much, prof. Really, really helpful.
  • Hey yaffle,
    Here is a basic skeleton of what I've been working with.
  • Hey yaffle,
    Here is a basic skeleton of what I've been working with.
Sign In or Register to comment.