Howdy, Stranger!

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

What's the best way of accessing a passage multiple times?

I need to access the same passage from various points within the story I am writing in T2 Harlowe.

I have thought about using (display:"reused passage"), but I am not sure if this will work, because there are several links in the reused passage, and I am not sure how to get back to the original passage. Will T2 simply return when all code has been run through, no matter how many links are clicked in the meantime?

I have also considered using a variable containing the name of the passage I want to return to after visiting the reused passage, ie. ($passage="return here") and when the reused passage code is done, doing a (goto:$passage).

Are there other ways of doing this? Thanks.

Comments

  • I have considered answering this a couple of times already, but every time I come back to it, I keep thinking you have the answer already. Is it not working for you?
  • wingsofwax wrote: »
    I have also considered using a variable containing the name of the passage I want to return to after visiting the reused passage, ie. ($passage="return here") and when the reused passage code is done, doing a (goto:$passage).

    Are there other ways of doing this? Thanks.

    You can do that, but there is another way. Here's Greyelf on the matter:
    greyelf wrote: »
    According to the Harlowe documentation you can use the (history:) macro to determine which passages the reader has visited, and it states that using (history:)'s last will give you the title of the last passage.

    So you should be able to do the following but there seems to be a bug:
    (set: $previous to (history:)'s last)
    $previous
    

    For now you will need to assign the array returned by (history:) to a variable first before finding out the last entry:
    (set: $history to (history:))
    (set: $previous to $history's last)
    $previous
    

    Using Greyelf's example:

    start

    This is the start passage.

    Go to the reused passage->reusedPassage.



    reusedPassage

    (set: $history to (history:))
    (set: $previous to $history's last)

    Link to the previous passage:

    (link: "Previous")[(goto: $previous)]


    Attached is an HTML file with the above code.
  • Thank you! That was spot on.
Sign In or Register to comment.