0 votes
by (300 points)

I'm trying to add text and repeat the same text over a period of clicks.

Original:
"text"
link_1 move to passage
link_2 adds additional text

After clicking link_2:
"text"
"additional text"
link_1 move to passage
link_2 adds additional text 2

After clicking link_3:
"text"
"additional text"
"additional text 2"
link_1 move to passage
link_2 adds additional text 3

and at the end:
"text"
"additional text"
"additional text 2"
"additional text 3"
link_1 move to passage

I think i could do it in while loop but I realized that twine doesnt work like that.

I tried prepend, append, and replace, i can't seem to work them right how i like it.

1 Answer

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

 

<<set $counter to 0>>
<<set $mytext to ["text", "additional text", "additional text 2"]>>
<span id ="example"></span>
<<nobr>>
<span id="link">
<<link "name">>
	<<append "#example">>$mytext[$counter]<br><</append>>
	<<set $counter++>>
	<<if ndef $mytext[$counter]>>
		<<replace "#link">><</replace>>
	<</if>>
<</link>>
</span>
<</nobr>>

 

by (300 points)
It works! thank you!

Now i'm trying to find ways to fade the links out and make them reappear again using the same click/link. Thank you again for the answer!
...