Howdy, Stranger!

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

How do I Close Inventory and return to previous Passage?

I've been following this tutorial on how to make an inventory system: http://gersande.com/designing-inventories-in-twine-2-with-the-built-in-harlowe-macros/#1

It's been really helpful so far, until I ran into their comment about using (history:)'s last. I don't want to use it because this is going to be a long game that may or may not have an option to view the inventory from a lot of different passages.

I want to have later passages that only happen if you have a certain item in your inventory.

How would I go about doing this in Harlowe?

Comments

  • edited April 2016
    I believe point 4.1 in that tutorial shows the code used to add a link which will move the Reader forward to the previously show Passage.
    edit: I should learn to read the whole of a question!

    Your other option is to use a variable to track the last non-inventory passage shown, and then to use a link based on that variable.

    1. Add a header tagged passage to your story and place the following in it, it tracks all passages that do not contain an inventory tag
    {(if: not ((passage:)'s tags contains "inventory"))[
    	(set: $last to (passage:)'s name)
    ]}
    

    2. Add an inventory tag to all Passage's related to Inventory

    3. Use the following link to move forward to the last non-inventory passage.
    (link-goto: "Last", $last)
    
  • It gets stuck on the first page of the Inventory (where it lists what you have). When I hit Last on that page, it just reloads that page.
  • Did you assign an inventory tag to the first page (passage) of the Inventory?
  • Yes. And for every subsequent passage in the inventory. The subsequent passages return to the first inventory passage.
  • I have attached an archive file containing a demo, use the Import From File option to import the Close Inventory Demo project and then run it.
  • It works! Thank you so much. I think I might have misspelled something which was causing it not to work.
Sign In or Register to comment.