I suck at twine so there's probably a much simpler and easier way to do this, but here's my solution:
Have some kind of variable.. Set it to 0 in your passage where you choose options from. When you select the option, at the beginning of that passage, set it to 1.
You should have the links to the passages within an if statement so that they only show up when the variable is 0.
It would look something like this?
________________________________ some other passage: (set: $var to 0)
________________________ parent passage:
(if: $var is 0)b][[Choice A[/b]]
_______________________ Choice A:
________________________
So then when you go back, choice A shouldn't show up anymore. I'm sure there's a better way to do this but I hoped this helped.
A couple of minor enhancements to @yalli_smay excellent solution.
a. Code/Passage Examples: Please use the C button in the comment field's toolbar to wrap code/passage example within code markup, it makes finding and reading those examples easier.
This passage assigns a value to a variable.
(set: $var to "value")
b. Boolean values: If a variable is being used to indicate when something is true or false then it is better to use those values instead of the numbers 1 and 0. The following example shows how to test if a variable equals true, and how to use the not operator to check if a variables equals false.
(set: $var to true)\
(if: $var)[The var variable equals true]
(set: $var to false)\
(if: not $var)[The var variable equals false]
c. Initialising Variables: One ideal place to initialise your story's variables is within a startup tagged passage.
d. Multi-passage examples: You can use TWEE Notation to define the contents of multiple passages within a single example.
e. Three Consecutive Open Squares: There is currently a parsing bug in Twine 2 which results in incorrectly named auto generated passages if it finds an extra Open Square Bracket directly before a markup-based link, to get around this bug you need to place a single space character between the first and second square brackets.
Bad Example:
(if: not $var)[[[Choice A]]]
Good Example: (note the extra space character)
(if: not $var)[ [[Choice A]]]
Based on the above five points @yalli_smay's example would look something like the following, it was written using Twee Notation.
:: Startup [startup]
(set: $var to false)
:: parent passage
(if: not $var)[ [[Choice A]]]
:: Choice A
(set: $var to true)\
\
blahblahblah
[[parent passage]]
creates blank lines in my first page. How to change this?
My mistake, I forgot to explain how to hide any output generated by a startup tagged passage. You will need to place CSS like the following in your story's Story Stylesheet area, it targets and hides the HTML element that represents that passage.
How can I get more than 1 choice in the original parent passage?
There are two basic options, and each one has it's Pros and Cons.
1. Variable Based:
You can use a separate variable to track the state of each link.
One of the benefits of this method is that it is easy to reset a variable back to false so that the link becomes available again, the downside is you need more variables which means the History system has more to track. note: the following example is written using Twee Notation.
:: Startup [startup]
(set: $seenChoiceA to false)
(set: $seenChoiceB to false)
:: parent passage
(if: not $seenChoiceA)[ [[Choice A]]]
(if: not $seenChoiceB)[ [[Choice B]]]
:: Choice A
(set: $seenChoiceA to true)\
\
blahblahblah
[[parent passage]]
:: Choice B
(set: $seenChoiceB to true)\
\
blahblahblah
[[parent passage]]
2. History Based:
You can use the (history: ) macro to determine if a passage has already been navigated to by the Reader.
One benefit of this method is you don't need to create new variables, the main downside is that the Array returned by that macro contains the names of ALL passages visited in the order that they were visited in and the contains operator looks at EVERY element in the array when determining if the value you are looking for exists which means it can take slightly longer to search the whole array as it gets larger and larger.
warning: If your story involves the Reader traversing the same passages multiple times (like a RPG can) and if you search the (history:) macro array multiple times within the same passage, then after a while the Reader may notice a slight delay in the rendering of this passage.
To convert TWEE notation into individual passages you simple create each passage referenced on the lines starting with double colons :: then copy all the lines between that line and the next line starting with a double colon (or the end of the example) into the new passage's body. If the first line with double colons ends with text between open/close square brackets then each word in that text gets added to the new passage as tags.
eg. If you have the following example:
:: Startup [startup]
(set: $var to false)
:: parent passage
(if: not $var)[ [[Choice A]]]
... then you would create two new passages, one named Startup and the other named parent passage. The Startup passage would have a single tag named startup and the body would contain the (set: $var to false) code. The body of the parent passage would contain the (if: not $var)[ Choice A] code.
Comments
:-)
Have some kind of variable.. Set it to 0 in your passage where you choose options from. When you select the option, at the beginning of that passage, set it to 1.
You should have the links to the passages within an if statement so that they only show up when the variable is 0.
It would look something like this?
________________________________
some other passage:
(set: $var to 0)
________________________
parent passage:
(if: $var is 0)b][[Choice A[/b]]
_______________________
Choice A:
(set: $var to 1)
blahblahblah
parent passage
________________________
So then when you go back, choice A shouldn't show up anymore. I'm sure there's a better way to do this but I hoped this helped.
a. Code/Passage Examples: Please use the C button in the comment field's toolbar to wrap code/passage example within code markup, it makes finding and reading those examples easier.
b. Boolean values: If a variable is being used to indicate when something is true or false then it is better to use those values instead of the numbers 1 and 0. The following example shows how to test if a variable equals true, and how to use the not operator to check if a variables equals false.
c. Initialising Variables: One ideal place to initialise your story's variables is within a startup tagged passage.
d. Multi-passage examples: You can use TWEE Notation to define the contents of multiple passages within a single example.
e. Three Consecutive Open Squares: There is currently a parsing bug in Twine 2 which results in incorrectly named auto generated passages if it finds an extra Open Square Bracket directly before a markup-based link, to get around this bug you need to place a single space character between the first and second square brackets.
Based on the above five points @yalli_smay's example would look something like the following, it was written using Twee Notation.
Two things, if you please:
In the example given above, what I do not understand is that if I put:
When I return to the parent passage, I have no choice since it is said that all the choices are true.
How can I get more than 1 choice in the original parent passage?
More of this: is it possible to have this in a (display:) option as a parent passage ?
The other point is about the startup page.
I use it as the manual advises but everything I put in it creates blank lines in my first page. How to change this?
Thank you a million !
There are two basic options, and each one has it's Pros and Cons.
1. Variable Based:
You can use a separate variable to track the state of each link.
One of the benefits of this method is that it is easy to reset a variable back to false so that the link becomes available again, the downside is you need more variables which means the History system has more to track. note: the following example is written using Twee Notation.
2. History Based:
You can use the (history: ) macro to determine if a passage has already been navigated to by the Reader.
One benefit of this method is you don't need to create new variables, the main downside is that the Array returned by that macro contains the names of ALL passages visited in the order that they were visited in and the contains operator looks at EVERY element in the array when determining if the value you are looking for exists which means it can take slightly longer to search the whole array as it gets larger and larger.
warning: If your story involves the Reader traversing the same passages multiple times (like a RPG can) and if you search the (history:) macro array multiple times within the same passage, then after a while the Reader may notice a slight delay in the rendering of this passage.
The best way to determine if something is possible is to try it. *smile*
The following example replaces the contents of parent passage and adds a new passage named Choices, it is written using Twee Notation.
PS: I don't know why but if i put Twee Notation into my scenario, i get the Twee Notation as text with " :: Twee Notation " as the beginning...
eg. If you have the following example: ... then you would create two new passages, one named Startup and the other named parent passage. The Startup passage would have a single tag named startup and the body would contain the (set: $var to false) code. The body of the parent passage would contain the (if: not $var)[ Choice A] code.
I was thinking Twee notation was something like this
:-)
Thank you so much!
All my best
David