0 votes
by (160 points)
reopened by
So my question I think says it all. But in more detail, I have three choices for the player to say in the next passage so

You choose "X" -> you would say "X" in the next passage
You choose "Y" -> you would say "Y" in the next passage etc...

I thought this could save me space and time rather than make passages for each choice and link them. The passage you would end up after the choice is pretty much the same, I just need to change one or two sentences based on the player's choice, so it would be a waste of time if I just copy-paste the passages just to change a sentence. Sorry if it was long OR it was asked before, but I didn't find any question relatable to this. I guess it should be easy, but I'm a newbie :P


1 Answer

+1 vote
by (880 points)
selected by
Best answer

One way to do it is with conditionals (control macros): you can use if/elseif/else/endif  or switches (when there are a lot of possibilities for a particular string of text).

For example, in an early passage you'd set a global variable (one which starts with a $) which determines that some phrase would be shown later:

<<set $show = true>>

Then in some subsequent passage you'd show appropriate text if that variable had been set to true:

<<if $show>> This is shown. <<else>> Otherwise this is shown. <<endif>>  (alternatively you can use <</if>> )

With judicious use of <<nobr>> and \ you can control whether linebreaks appear before or after the conditional text: it can be a single word in the middle of a sentence (when you don't want it to be on a line by itself) or several paragraphs (when you do want line breaks).

For more information, see https://www.motoslave.net/sugarcube/2/docs/#macros-control

by (160 points)
Thanks man, I really appreciate it!!
by (61.5k points)
Please select the appropriate answer (using the check mark) or write your own answer and select that rather than just locking the question, so future users know that this question was adequately answered and can refer to it.
by (160 points)
Right, sorry I forgot to do it.
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.