Twine Version: 2.3.16
Story Format: Sugarcube 2.36.1
I’m sure this question has been asked before, but is there a way to show the default Saves button only in two specific passages? I mean, obviously it’ll be shown in the sidebar, but only when players are in the “Title Screen” (for loading purposes) and “Home” passages. I have been pouring over the sugarcube documentation, but without much luck. Honestly, I’m not even sure what I’m looking for - I’m more author than programmer.
Anyway, it’s for a primitive compatibility bridge between “old saves” and “new updates,” and I figured the easiest way would be to call a custom widget from the Home passage to add new variables to old saves… I really appreciate any help or advise you guys can give me?
The SugarCube HTML documentation shows that the element that represents the sidebar’s Saves “button” has an ID of menu-item-saves
, so a CSS Rule that targets that identifier can be used alter the styling of that specific “button”.
Passage Tags can be used to identify one set of passages from another, and these tags are added to specific HTML elements when the tagged Passage is visited. So if a known tag like savable
was add to the Passage in which saving is allowed, that tag’s existence could used as part of the above mentioned CSS Rule’s selector.
Adding the following CSS Rules to your project’s Story Stylesheet area will cause the Save “button” to be:
- be hidden by default.
- only shown when a Passage with a
savable
tag is visited.
#menu-item-saves {
display: none;
}
body[data-tags="savable"] #menu-item-saves {
display: revert;
}
Thank you very much, Greyelf. That did the trick, and it was a lot simpler than I had feared. A thousand times thank you
As an aside, there is already a programmatic way to handle save upgrades which might mean you don’t need to do this. Have a look at Save.onload.add()
(SugarCube v2 Documentation)