Click a word and reveal another line of text

+2 votes
asked Oct 12 by JessRun (140 points)
I'm new to Twine and I'm having a hard time trying to figure out how to do something or if it's even possible.

I would like to make it so that I can have someone click a word and another line of text appear on  a different line.

ie.

I love cats (click "love" and then)

But not as much as dogs (appears underneath it)

All the things I've tried causes the next line to become inserted in the first one.

4 Answers

+2 votes
answered Oct 12 by Chapel (33,020 points)
As mentioned in the instructions on the question from, we need to know which story format and version of the story format you are using to help. Answers and advice vary wildly based on that information.

What you're asking for is possible in every story format, but the specific code you'd write will be different based on which you're using.
0 votes
answered Oct 13 by Deadshot (2,310 points)
No offence, but, this is a really easy thing to do, in all formats I believe. So, since you're really new to twine, I suggest you watch some youtube vids and check out this site:

twine2.neocities.org

If you have a problem, search the old forums first. Then, if you're really stuck, ask a question here.

Also, in future, please state the story format like Chapel says.
0 votes
answered Oct 13 by hkfto (1,340 points)

I think this is a good question, because, assuming Twine 2 and Harlowe 1.2.4, it's not obvious how you'd do it. JessRun is right that using (replace:) or similar macros would make the new text appear within the old phrase, if the link was only to "love". For example:

I love cats
(click-replace: "love")[But I love dogs better]

would result in "I But I love dogs better cats"

You'd need to adjust the text you were including in the link to make the outcome understandable. Such as:

I love cats
(click-replace: "I love cats")[I love cats, but I love dogs better.]

This would give "I love cats, but I love dogs better" which is the desired output, but in terms of aesthetics/the appearance of the link, it means the whole phrase "I love cats" has to be part of the click-replace link, rather than the word "love" only.

Entirely possible I'm missing something--maybe you can make "love" into a link that results in more text appearing somewhere else in the passage--but I think it's a valid question. I've read the documentation and I don't know how to do it.

commented Oct 14 by greyelf (42,310 points)

note: Due to how Harlowe's (click:) related macros work internally it is generally better to use its (link) related macros whenever you need to show a link, unless you need multiple links in a Passage to execute the same associated hook.

In the particular use-case you describe @hkfto you should use the (link:) macro like so:

(link: "I love cats")[I love cats, but I love dogs better.]

 

0 votes
answered Oct 14 by adeptB (360 points)

This works in Harlowe by making "love" a hook that I've called dgs.

I [love]<dgs| cats
(click: ?dgs)[But not as much as dogs]

 

commented Oct 14 by greyelf (42,310 points)

note: Due to how Harlowe's (click:) related macros work internally it is generally better to use its (link) related macros whenever you need to show a link, unless you need multiple links in a Passage to execute the same associated hook.

In the particular use-case you describe @adeptB I would suggest using one of the two following methods instead.

1. Harlowe 2.x only: I would suggest using a (link-reveal:) macro and a hidden named hook combined with the (show:) macro like so:

I (link-reveal: "love")[(show: ?dogs)] cats.
|dogs)[But not as much as dogs]

2. Harlowe 1.x or 2.x: I would suggest using a (link-reveal:) macro combined with a named hook and the (replace:) macro like so

I (link-reveal: "love")[(replace: ?dogs)[But not as much as dogs]] cats.
|dogs>[]

 

commented Oct 15 by adeptB (360 points)
ok, thanks. I was wondering how to use the show and reveal.
Welcome to Twine Q&A, where you can ask questions and receive answers from other members of the community.

You can also find hints and information on Twine on the official wiki and the old forums archive.

See a spam question? Flag it instead of downvoting. A question flagged enough times will automatically be hidden while moderators review it.
...