0 votes
by (1.7k points)
This feels like a dumb question...

I know the StoryTitle is vital to Sugarcube 2 in Twine 1 -- but can it be reset, as a variable would, at a certain point during the story? I tried using Javascript (within a passage, using <<script>>) to set the document.title halfway through, but it seemed to have no effect.

2 Answers

0 votes
by (63.1k points)
selected by
Best answer

This worked for me in my game:

<<switch $chapter>>
<<case 0>>
	<<set document.title = "Holy Land: Prologue">>
<<case 1>>
	<<set document.title = "Holy Land: Chapter 1">>
<<case 2>>
	<<set document.title = "Holy Land: Chapter 2">>
<<case 3>>
	<<set document.title = "Holy Land: Chapter 3">>
<<case 4>>
	<<set document.title = "Holy Land: Chapter 4">>
<<case 5>>
	<<set document.title = "Holy Land: Chapter 5">>
<<case 6>>
	<<set document.title = "Holy Land: Chapter 6">>
<<case 7>>
	<<set document.title = "Holy Land: Chapter 7">>
<<case 8>>
	<<set document.title = "Holy Land: Epilogue">>
	<<set document.title = "+ Holy Land">>

If you want to alter the StoryTitle as displayed in the sidebar, you should hide the actual title via CSS and use the StorySubtitle or StoryCaption special passage; you can always alter the CSS of one of those two special passages to look like StoryTitle.

by (1.7k points)
Works like a charm. Thanks as ever.
0 votes
by (159k points)
What issue are you trying to solve that makes you believe that changing the story format's internal title property is the answer?
by (1.7k points)
No issue to solve.

I thought it'd be an interesting addition, especially in a horror/mystery Twine, for the title of the webpage itself to change during the course of the story.