A twine beginners questions

marsup

Well-Known Member
Sep 6, 2016
120
23
So a long time ago I had asked what program would be good for a beginner in coding that wanted to make a slave management game and I was directed to twine. I have actually gotten started with making it, I am still learning the ropes but for the most part its a question of time and practice. However, there are 2 things that I can't seem to find any guide that could help me or give me hints and was hoping the more knowlegeable members of the community could help me out.

1) I can't seem to figure out how to add options in the sidebar in the sugarcube format. I can't seem to find a guide that explains how to do so. For example in free cities in the side bar there is the money, reputation, the how to play guide etc.

2) Is it actually possible to randomly generate characters in twine? Could I make like a seperate unlinked passage with all the variables from which the game picks them out? I have looked at free cities in twine but I can't seem to figure out how he did the random generation part.

I might have more questions later on but right now I will keep trying to learn on my own and hopefully gain enough knowledge to eventually make something concrete.

Thank you for your help
 

wibble

Active Member
Sep 13, 2017
27
13
35
1: Twinery's forum gives the following suggestion for problem ( https://twinery.org/forum/discussion/5464/sugarcube-adding-items-to-the-sidebar )

Create a passage called "StoryMenu", or "StoryCaption" (you can have both, they are slightly different.) and put things in there like a normal passage.

2: The following is an example of assigning a random integer value (0,1,...,5) to a variable called $variable and then acting on it.

<<silently>>
<<set $variable to random(5)>>
<<if $variable is 0 do stuff>><</if>>
<<if $variable is 1 do stuff>><</if>>
<<if $variable is 2 do stuff>><</if>>
<<if $variable is 3 do stuff>><</if>>
<<if $variable is 4 do stuff>><</if>>
<<if $variable is 5 do stuff>><</if>>
<</silently>>

(This is how to do it in Twine 1 / Sugarcube. The random(n) function exists in most twine languages, if not all of them.)