0 votes
asked by (300 points)
edited by

I'm curious if this is possible.

I can do it using links and widgets by:

link still exist unless the selector is replaced or removed.
<<link "add 1 strength">>
 <<display change>>
<</link>>

deactivates the link and change the text.
<<linkreplace "1 strength added">>
  add 1 strength
<</linkreplace>>

However doing those for multiple choices are not efficient.

Like:

@@#group1;
<<link "choice 1">>
 choice 1
 <<replace "#group1">>
   Chosen 1
 <</replace>>
<</link>>
<<link "choice 2">>
 choice 2
 <<replace "#group1">>
   Chosen 2
 <</replace>>
<</link>>
<<link "choice 3">>
 choice 3
 <<replace "#group1">>
   Chosen 3
 <</replace>>
<</link>>
@@

@@#group2;
<<linkreplace "choice 1">>
 choice 1
 <<replace "#group2">>
  Chosen 1
 <</replace>>
<</linkreplace>>
<<linkreplace "choice 2">>
 choice 2
 <<replace "#group2">>
  Chosen 2
 <</replace>>
<</linkreplace>>
<<linkreplace "choice 3">>
 choice 3
 <<replace "#group2">>
 Chosen 3
 <</replace>>
<</linkreplace>>
@@

I learned how to use widget, its so nifty!

Edit to add:

Also to display the next paragraphs on the same passage with the choices/links.

Example:

Clicked choice 1 -- renders codes/displays for choice 1

Then continue on to the next paragraphs not passage.

It would be easy to just make and include another passage but i'd rather have them in one passage.

1 Answer

0 votes
answered by (22.3k points)
edited by

You can use a <<for>> loop. Not sure that'd be more efficient though. For example:

<<set $test to 0>>
<<set $choices to ["<<set $test++>>$test", "<<set $test+=2>>$test", "<<set $test+=3>>$test"]>>

@@#group1;
<<nobr>>
<<for _i to 0; _i lt $choices.length; _i++>>

<<set _j to _i + 1>>

<<capture $choices[_i]>>
<<link "choice _j">>
<<replace "#group1">>$choices[_i]<</replace>>
<</link>>
<</capture>>

<br>

<</for>>
<</nobr>>
@@

 

commented by (300 points)
edited by

Oh thanks! I can use that for populating the choices instead of manualling typing them.

This is what I'm trying to accomplish.

I'm using widgets for the choices.

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.
...