Howdy, Stranger!

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

How do you add text to another passage with a link within a different passage?

I'm using Twine 2.0 and Harlowe.

In my game the character "downloads" a link onto their tablet giving them diagnostic information. I was wondering how to write text or better yet make a new link appear on the tablet by the user clicking a button within the passage they're on.


  • edited May 2017
    You need to state the name and full version number of the Story Format you are using, as answers can be different for each one. Because you mentioned Harlowe I will assume you are using Twine 2's current default which is v1.2.4

    You can use a story variable to track if the 'diagnostic information link' has been downloaded, and then use an (if:) macro to control what is shown to the Reader.

    To handle the 'make a new link appear' part of your question you can use a named hook combined with (replace: ) macro, which can be activated via a (link:) macro.

    1. Initialising you story variable in a startup tagged special Passage.
    (set: $linkDownloaded to false)

    2. Conditionally offering a Download option.
    The following ''Revisit this Passage'' link is being used to test what this passage will show if the Reader returns to this passage later.
    If selected (text-style: "underline")[before] the ''Download'' link then the passage should look look the same as first visit, if seleced (text-style: "underline")[after] the ''Download'' link then the ''Diagnostic Information'' link should be shown instead.
    [[Revisit this Passage->First]]
    (if: $linkDownloaded)[ [[Diagnostic Information]]]\
    []<links| {
    (link: "Download")[
    	(set: $linkDownloaded to true)
    	(replace: ?links)[ [[Diagnostic Information]]]

    a. The passage content above the (if:) macro can safely be deleted, as its only there for testing purposes and not needed by the solution.

    b. There is a single (white) space character between the opening double open square brackets of the markup-based links and the macro's associated hook's single open square bracket that the markup link is contained in. This is required due to a bug in Twine 2's "Auto create missing Passages" feature.
Sign In or Register to comment.