Howdy, Stranger!

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

Is it possible to display the passages chosen by the player?

Hi!
I'd like to make some kind of game where you build the story by yourself and you can see your past choices (passages) written in a list. Like, if you chose "I went to the forest" and then you chose "I went to the farm" the next passage contains:
I went to the forest
I went to the farm
While prompting you to make another choice. Would Twine allow that?

I'm using Harlowe, if that can help.

Comments

  • Assuming that the name of the related passages is the same as the link text then you could use the Array returned by the (history:) macro to track which choices were made.

    note: Harlowe does not currently have a built-in way to loop the elements of an Array, the follow uses the recursive (display:) macros method to simulate this functionality.

    1. The Visited Passages passage:
    The following code controls the visual placement of the visited passages list. In my test story I assigned the special footer tag to it but this passage could also be made visible using (display: "Visited Passages")
    |passageList>[]\
    (set: $passageList to (history:))\
    (set: $passageIndex to 0)\
    |workarea>[(display: "Passage List Logic")]
    


    2. The Passage List Logic passage:
    The following code loops through the list and generates the visual output.
    (set: $passageIndex to it + 1)
    (if: $passageIndex <= $passageList's length)[
    	(append: ?passageList)[
    (print: $passageList's ($passageIndex))]
    	(replace: ?workarea)[(display: "Passage List Logic")]
    ]
    
  • Oh that looks very, very interesting and problem-solving. Thank you so much greyelf. I'll look into it this evening.
Sign In or Register to comment.