Hey! This is my first time making a forum, so I’m sorry if it’s weird or hard to understand.
I have a string in my game at the very first passage that says:
When I playtest my game starting from this passage, on the UI bar, the options menu shows and the stuff inside the options tab appear. But when I try to open the game on a different passage, the options disappear, and I’m assuming that is because the options only show on this passage, and I have to somehow put it in the CSS.
The thing is though, when I tried to put this exact same string into the CSS, I get errors on
“Content Settings”, “You must refresh your page to see changes.”
label: “Allow Adult Content:”
Does anyone know why? And could anyone help me put it as a CSS?
I tried to copy and paste my code into a passage called “StoryInit” but when I playtest it, I get a notification saying that there isn’t a closing statement for “script”, even though at the end of the string I have “/script” already.
If you can, please post all of the code that you’re inserting into StoryInit. There are many possible causes for the error message that you’ve reported, although an overlooked typo is common.
To ensure that readers of the post can see the code, type three back-ticks ``` on the preceding and subsequent lines. On most U.S. keyboards, the “back-tick” character (`) is in the upper-left corner of the keyboard, on the same key as the tilde (~), but not shifted. The code you post will then look something like this:
Based on the fact that you mentioned “settings” and “label:” in your question, I will assume that you are trying to use the Setting API.
Yep. Specifically, I want to have a settings that would enable adult content if players are comfortable playing with themes of violence, drugs, and sex, so by default they wouldn’t be able to play through that unless they turned that on. But I noticed on different passages or when I loaded a save, the settings UI disappeared.
The toolbar above this forum’s comment field has a </> button in it, that can be used to wrap a code example in Preformatted Text markup.
So to include a code example in your comment:
Place the typing cursor at the start of an empty line.
Select the </> button, which will add the following to the comment field.
type or paste code here
Add your code example between the two lines that start with ```
<<set $thing to “value”>>
<<if $thing is “value”>>…do something…<>
The result of point 3 should look something like the following to anyone reading your posted comment.
<<set $thing to "value">>
<<if $thing is "value">>..do something..<</if>>
Setting.addHeader("Content Settings", "You must refresh your page to see changes.");
label : "Allow Adult Content:"
…and you will then be able to use the associate settings.allowAdultContent Boolean variable to conditionally show the content of a Passage.
Welcome to the Library!
Which book do you want to read?
[[Adventure Book|Read an Adventure]]
[[History Book|Learn Some History]]
<<if settings.allowAdultContent>>[[Erotic Novel|Waste some time]]<</if>>