0 votes
by (790 points)
I think this is quite a basic question but I can't seem to find the answer. What I want is for the player to click on a link that keeps that link word and generates a new line (i.e. a normal link append), but this new line has a link append of its own (which generates a third line). The reason I have problems with this is that the closing tag for the first link append overlaps with that of the second - is there a way to differentiate between the two, or should I be coding this differently?

2 Answers

+1 vote
by (159k points)
selected by
 
Best answer

not phrasing the question specifically enough.... How would the linkappend tags be positioned in this case?

That is a whole different nightmare, which you can't solve using the <<linkappend>> macro because it is designed to append the 'additional text' directly after the 'Link Text', and you want that 'addition text' appended to the end of line containing the link.

NOTE: The following solution is just one a number of implementations you could use, each one is just as messy as the other because the effect you're asking for (a Jonah type endless-page layout) isn't as easy to implement as you may think.

Without creating your own custom set of macros I believe you will need to use the <<linkreplace>> macro and the <<append>> macro to achieve what you want, and even then the implementation will be very messy.

1. Create a target for your <<append>> macros using an ID'ed Custom Style.

This target can also contain your first line of text and first <<linkreplace>> macro, which will use the <<include>> macro to inject the TwineScript for displaying the 2nd line of text and link.

@@#output;
The <<linkreplace "quick">><<include "Line 2">><</linkreplace>> brown fox
@@

2. The Line 2 Passage is used to inject the 2nd line of text.

This passage first overwrites the 1st link's Link Text, it then uses an <<append>> macro to add the 2nd line of text containing the 2nd link. The second link uses an <<include>> macro like the 1st link did.

quick\
<<append "#output">>
	\<br>jumped
	\ <<linkreplace "over">><<include "Final Line">><</linkreplace>>
	\ the
\<</append>>

3. The Final Line Passage is used to inject the 3rd and final line of text.

This passage basic works the same way as the previous one did.

over\
<<append "#output">><br>the lazy dog.<</append>>

The more lines of text (containing a link) you want the more copies of the Line 2 passage you will need, and each of those passages will need a unique name.

by (790 points)
You're amazing. I can't thank you enough.
+1 vote
by (159k points)

You just need to make sure you have a <</linkappend>> tag at the end for each of your <<linkappend>> tags like so.

1st Line of text.
<<linkappend "2nd Line of text">>
<<linkappend "3rd Line of text">>
<<linkappend "4th Line of text">>
<</linkappend>><</linkappend>><</linkappend>>

... or in an indented format so you can see the nesting easier.

1st Line of text.
<<linkappend "2nd Line of text">>
	<<linkappend "3rd Line of text">>
		<<linkappend "4th Line of text">>
		<</linkappend>>\
	<</linkappend>>\
<</linkappend>>

NOTE: If you are trying to create a endless-page layout similar to that of the Twine 1 Jonah story format then this technique is not the best (or cleanest) way to go about it.

by (790 points)
Thanks a lot! That wasn't exactly what I meant but that's my fault for not phrasing the question specifically enough. I don't want the whole line to be a link, just a specific word in the line. In other words, the player clicks on a word in the first line, and that generates a second line of which only one word can generate a third line, and so on. How would the linkappend tags be positioned in this case?
by (159k points)
See my next answer.
...