Hi all,
I'm new to Twine and have been trying to learn by making a game and by using this forum and documentation, but I'm stuck on two things. Sorry if these have been covered before or are dumb questions - I've tried searching to no end. I'm using Harlowe/Twine 2.
1) Is it possible to set a variable to be either one of two things? For instance, if I were trying to make $party display either "Kitten Party" or "Puppy Party" completely randomly. Is there an easy (or even a convoluted) way to achieve this?
2) Is there a way to display a passage in the sidebar? For example, I've made a fake social media account that gets updated as you progress through the game and I'd like to have it appear in the sidebar. The whole thing is built in a passage, so I had assumed I would be able to (display:) it, but have not been able to get that to work. Any suggestions?
Thanks - I appreciate any help or suggestions!
Comments
1a. Value is randomly determine only once, and there after the $party variable displays the same value.
1b. Value is randomly determine each time you display the $party variable. note: because 1b is random it is possible that all five outputs will be the same, if so then refresh the page until they are not. lol
Harlowe's sidebar is an illusion, it is actually additional content added to the start of the current Passage's generated HTML, that has been visually "moved" sideways using CSS.
A very simplified version of that generated HTML: The answer to the Harlowe: CSS Help - Three screen divisions, two with independent scrollbars thread explains how to position one of your own Passages so that it appears in the same general location as the sidebar. I suggest also reading the two linked threads found at the start of that answer.
p.s. You could also use Javascript to "move" (detach/reattach) HTML content displayed on the current page into the sidebar so that it would actually be part of the the sidebar but that is more complex and would need to be done each time the Reader navigates between Passages because the sidebar is destroyed and then recreated.