WARNING:
SugarCube Story History system only persists the changes made to story variables when a Passage Transition occurs which is the activity of moving from one Passage to another (can be the same Passage again), and a Save is a snapshot of the current Story History at the time the save was made.
This means that all the story variable changes you make during your 'conversational' interaction code will NOT be tracked by the History system (and will not be persisted in a Save) until after the next Passage Transition is made.
There are a number of different ways you could implement this, the following is one of them.
1. Place the following CSS within your Story Stylesheet area.
.opaque {
opacity: 0;
}
.fade-in {
opacity: 1;
-webkit-transition: opacity 2s ease-in;
-moz-transition: opacity 2s ease-in;
-ms-transition: opacity 2s ease-in;
-o-transition: opacity 2s ease-in;
transition: opacity 2s ease-in;
}
.not-selected {
opacity: 0;
-webkit-transition: opacity 2s ease-in;
-moz-transition: opacity 2s ease-in;
-ms-transition: opacity 2s ease-in;
-o-transition: opacity 2s ease-in;
transition: opacity 2s ease-in;
pointer-events: none;
cursor: default;
}
.selected {
color: rgb(190, 130, 0);
}
2. Place the following TwineScript with the passage you want to contain the conversation.
<div id="first-question">
First question?
<span class="first-choice">
\<<linkreplace "Choice 1">>
\@@.selected;Choice 1@@
\<<addclass "#first-question .second-choice" "not-selected">>
\<<addclass "#second-question" "fade-in">>
\<</linkreplace>>
\</span>
<span class="second-choice">
\<<linkreplace "Choice 2">>
\@@.selected;Choice 2@@
\<<addclass "#first-question .first-choice" "not-selected">>
\<<addclass "#second-question" "fade-in">>
\<</linkreplace>>
\</span>
</div>
<div id="second-question" class="opaque">
First Question's Answer.
Second question?
<span class="first-choice">
\<<linkreplace "Choice 1">>
\@@.selected;Choice 1@@
\<<addclass "#second-question .second-choice" "not-selected">>
\<<addclass "#third-question" "fade-in">>
\<</linkreplace>>
\</span>
<span class="second-choice">
\<<linkreplace "Choice 2">>
\@@.selected;Choice 2@@
\<<addclass "#second-question .first-choice" "not-selected">>
\<<addclass "#third-question" "fade-in">>
\<</linkreplace>>
\</span>
</div>
<div id="third-question" class="opaque">
... see code for second question....
</div>
... the above works by 'hiding' all the questions but the first and only revealing the next once the previous has been answered, this makes it a little easier to layout the full page of questions and answers because you're not trying to inject each question/answer combination into the page using a <<replace>> macro.