Howdy, Stranger!

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

Harlowe - Adding text to a paragraph after a choice

Hi! First post, sorry if this has been answered but searches didn't turn anything up (though maybe I just don't know the terminology).

What I'm trying to do is add to the existing, already visible text after the player selects a choice. For instance,

"I ran up the stairs, anxious at [[what I would find...]]"

When the player selects the link, it changes (without a refresh) to

"I ran up the stairs, anxious at what I would find. Sure enough, the dog had found - and destroyed - a roll of toilet paper."

People may recognize this style from the Inkle game "80 Days"; that (or something close to it) is what I'm going for -- continuing a paragraph after input from the player.

Any ideas? Thanks in advance!

Comments

  • Hi coil!

    Here's what you're looking for: http://twine2.neocities.org/
    [Fie and fuggaboo!]<shout|

    (click: ?shout)[ (replace: ?shout)["Blast and damnation!"] ]
    This will replace the text identified by "shout"--whatever is in the first set of [square brackets]--with whatever is in the set of second brackets. You can put the second line out of the way at the bottom of your passage, or right next to it, and all you have to do if you want more than one replace per passage is to duplicate this and rename all three instances of "shout".
  • Or to use your own example:

    I ran up the stairs, anxious at [what I would find...]<linkA|

    (click: ?linkA)[(replace: ?linkA)[<b>what I would find</b>. Sure enough, the dog had found - and destroyed - a roll of toilet paper.]]
    The hook defines the text you want to do something to, it is the [what I would find...]<linkA| part of the example, the hook name in the example is linkA

    The (click:) allows the text contained within the hook to be click-able, and to do something when it is clicked.

    The (replace:) is used to replace the text contained within the hook (but not the hook itself) with something else, in this case some more text.
  • Yeah, greyelf raises a good point: I totally didn't understand what I was writing every time, and coming up with a new hook name every time really helps to get your mind around it.
  • A hook name only needs to be unique within the passage (or composite passage if (display:) is involved) it is being used in, so if you have two unrelated passages both can have a hook with the same name.

    And because the hook still exists in the passage even after you use things like (replace:) on them, you can re-apply an effect to that same hook again.

    |options>[
    please select one of the following:
    [option 1]<opt|
    [option 2]<opt|
    [option 3]<opt|
    ]

    (click: ?opt)[
    (replace: ?options)[
    please select one of the following:
    [option A]<opt|
    [option B]<opt|
    [option C]<opt|
    ]
    (click: ?opt)[(replace: ?options)[No more options]]
    ]
  • Thank you all! Great help. I had a feeling hooks was what I wanted but I couldn't find any specifics on their use. I suspect that link will be a big help.
Sign In or Register to comment.