0 votes
asked by (120 points)
So I'm making a story with some, let's say, explicit content. Now, I don't want to spoil some of the options up front for people prepared to just stumble into whatever, but for the readers who might not be comfortable with some of the material I'm working on, I want to figure out if there's a way to have an option right at the beginning of my story that allows the to turn on or off content warnings. Is there a way to do this? I am kinda new at Twine and really HTML in general, so my primary option right now has been to make two parallel builds with a choice at the beginning, but that seems really inefficient.

2 Answers

+1 vote
answered by (109k points)

Please use the Question Tags to state the name and full version number of the Story Format you are using, as answers can vary based on this information. I will assume you are using Harlowe v2.1.0 which is the default story format for the Twine v2.2,1 application.

You can use a Story Variable to track if the Reader has chosen to enable the option or not, the Conditional Statements recipe in the Twine Cookbook shows you how to do that using a (set:) macro, it also shows how to conditionally show content based on the current value of the variable.

note: Ideally the initialisation of such story variables should be done within your project's startup tagged special passage.

You can use the (link:) macro combined with a (set:) macro to allow the Reader to change the current value of the story variable. The following example assumes that you have previously initialised a Boolean $showExplicit variable to a either true or false within your startup tagger passage, depending on what you want the default to be.

(link: "Enable Explicit Content")[
	(set: $showExplicit to true)
]
(link: "Hide Explicit Content")[
	(set: $showExplicit to false)
]

... then you can use the technique show in the previously linked recipe to conditionally show content based on the current value of $showExplicit like both of the following examples demonstrate.

(if: $showExplicit)[The variable equals true, show the Explicit Content]\
(else:)[Show the Non-explicit Content]

or

(unless: $showExplicit)[The variable equals false, show the Non-explicit Content]
(else:)[Show the Explicit Content]

 

0 votes
answered by (4.4k points)
There are so many ways to do this. What greyelf said works. If you're new to twine read this and prepare to get knowledged:

https://twine2.neocities.org/
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.
...