So I've been wondering if it's possible to remove the sidebar for the few first passages, and then automatically make it appear as the player moves on. Something like, during the first few passages (choosing character and such) the sidebar isn't there, and then once the story itself begins, the sidebar is there with all the information I want.
Is this a thing? Can it happen?
keep in mind I'm really new at this, please... thanks
Oh, an I'm using twine 2 with Sugarcube 2.18
Comments
1. Stow the side-bar.
You can use the UIBar.stow() function found in the UIBar API to stow/hide the side-bar when your story starts, this is done by placing code like the following within your story's Story Javascript area. ... you can later use code like the following within a passage to unstow the side-bar.
2. Totally hide the side-bar including the stow-bar.
This is a little harder because you need to:
a. Have some way to indicate when to hide the side bar, which you can do by marking each passage you want it hidden for with the same Passage Tag. The tag name you use is not important, this example will use no-side-bar
b. hide the side-bar and then move the story area over slightly to the left, both of which can be done using CSS withing your story's Story Stylesheet area.
The following CSS uses selectors based on the no-side-bar passage tag, if you use a different passage tag name then you will need to modify the selectors likewise.
And into the passage you want the Sidebar to appear you enter:
If you want to also move the story area, you can do the same by manipulating margin-left of #story.
1. It does not allow for the extra width added to the story left margin into which the side-bar is shown.
2. It is generally not a good idea to get beginners to use Javascript without actually supplying them with the background understanding of what exactly that Javascript is doing. The is an old saying about giving a person a fish vs teaching them how to fish.
Seems to work without any problem on my end.
Which like I said seems to work fine for me, unless I am overlooking something.
You assumed that the OP (and equally importantly everyone else reading this thread) had the knowledge/ability about Javascript to workout how to implement a margin left change, without supplying any references on where to get that information if they didn't nor an example. I am also partly guilty of something similar because I gave no references to information of the CSS I supplied them.
note: I am not trying to put down the excellent solutions you supply, I am just trying to make those solutions more complete so that all the people who read a thread looking for a similar solution will be able to understand it.
A few notes.
For the first rule. If you're setting the UI bar to not display at all, then you don't need to alter its left property at all since it will be removed from the layout completely.
For the second. You shouldn't need to use the general sibling selector in this case. Also, the default left margin for the story element is 2.5em—a stowed UI bar alters that to 4.5em to reserve space for itself, which you don't need it you're hiding/removing it.
Altogether, the changes would look like: