How do I make two links go to the same passage with different text? (Harlowe)

0 votes
asked Jan 3 by Tevault (160 points)

So, I'm about to pull my hair out fixing this.  I haven't been able to find anything that fixes this problem, though it may just be me being dense.

I'm trying to set up an example story like I had before my PC had to be wiped.  I had a macro example i could reference, but now I forgot how I st it up and need help.

The first passage is:

There's a potato.

[[Slice it->Potato Consequence]](set: $slice to 1)
[[Smash it->Potato Consequence]](set: $smash to 1) 

The second passage I want it pointing to is:

(if: $slice is 1)[Sliced.]
(if: $smashed is 1)[Smashed.]

I'm trying to get just Sliced to display if Slice it is selected, or just Smashed if Smash ti was clicked.

The problem is, they both link to Sliced.  I used to have this figured out, and I have no doubt it's something simple and obvious, but I can't find the guide that I figured it out form last time, so I need to ask for help.

I'm also a novice with programs like this, so a lot of the documentation just doesn't help me.

1 Answer

+1 vote
answered Jan 3 by TheMadExile (38,930 points)
selected Jan 4 by Tevault
Best answer

You cannot simply put macros after the link markup, that doesn't make them part of the link.  The reason you were seeing sliced each time was because both (set:) macros were being executed as part of the normal passage processing, since they weren't part of the links.

Try the following which uses the (link:) and (goto:) macros:

There's a potato.

(link: "Slice it")[(set: $slice to true)(goto: "Potato Consequence")]
(link: "Smash it")[(set: $smash to true)(goto: "Potato Consequence")]

Notice how the (set:) is within the hook of the (link:) macro, which makes it part of the link.

And then in the Potato Consequence passage:

(if: $slice)[Sliced.]
(elseif: $smashed)[Smashed.]

Beyond that.  You don't really need two variables there, since you're forcing a singular choice.  For example:

There's a potato.

(link: "Slice it")[(set: $potatoAction to "slice")(goto: "Potato Consequence")]
(link: "Smash it")[(set: $potatoAction to "smash")(goto: "Potato Consequence")]

And then in Potato Consequence:

(if: $potatoAction is "slice")[Sliced.]


commented Jan 3 by Tevault (160 points)
That's a massive help, thanks!

Gives me an example of a singular choice and multiple variations.
commented Jan 3 by Tevault (160 points)
So, I did everything as shown, and the links work, but every option goes lower on the page.  So Smashed is lower than Sliced in the linked passage.

Is there a way to fix it so the text for each link is shown at the top of the passage, regardless of how far down the code is?
commented Jan 4 by AnoeticDuckling (2,100 points)

just use the text wrap symbols

This line\ 

and this line 

\and this line, are actually just one line.

Is the example given of the usage on the harlowe documentation help thingy majig

so use it like

code code code1 [and all the stuff in that code thing]\

code of the code thing 2 [and boom this stuff will be on the same line as the previous thingy]

It may be a little more difficult than that, especially if the text in code one is longer than a single line, I'd get around that by using a print macro (that you can find through that link as well) and put all of the text of code one into the print macro so it'll collapse when using it injunction with the line break to make it all on one line. like

code code)[(print:)[all the text from the first option]]\

code code2)[like normal, the extra bracket isn't needed on this one because there's no extra macro involved]

commented Jan 4 by Tevault (160 points)
That was incredibly simple, and I feel like a doofus.  Thanks for the help!
commented Jan 4 by AnoeticDuckling (2,100 points)
I've been there, don't worry. lol, I've asked questions so dumb I already had the answer in my question.
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.