Wanting to Learn Twine.

So, I really struggle with reading instructions, but I want to learn how to use Twine.

I’ve got the from the 7th of Febuary to 6th of March off from work to learn how to use Rwine and get started on a game idea I’ve had burning away for a little while.

Can anyone either:

Explain INCREDIBLY SIMPLY how to use Twine and set up stats and make it remember events?

Or, show link me some good videos/what to put into YouTube’s search bar to find them.

I have the basic transition from one scene to the next down, but I’d like to get more complicated then that.

I want to know how to make stats, how to make the game keep track of them, how to implement inceeases to these stats and be able to show the player how much they have in the stats.

Like, you’ve got money, and you do a job. I want to learn how the job would calculate how much you earn, the variables to effect it and how to have it show up on the side of the screen.

Sorry, can’t help with that, I only use Twine for a massive CYOA text sandbox that doesn’t use any variables or such.

you might want to start with Twinery’s basic tutorials and the documentation for your choice of story type. given as you’re brand new to the environment, i’d recommend Harlowe.

for variables in particular, in Harlowe you can initialize and define any variable you want in one step:

(set: $someNumber = 10)

you’ll use the equal sign (=) for numeric values and “to” for strings and Booleans.

(set: $someText to "Hi there!")

the “$” in front is what makes it a story-wide variable - alternatively, you can use “_” in front to make it a temporary, passage-wide variable that goes away after you navigate away from the page.

(set: _someTemporaryText to "Super secret...")

you can refer to any variable you want just by referencing it, so long it’s already been initialized for that passage.

I have $someNumber apples.

you can change the value of a variable with that same (set:) function, either explicitly or by using another function.

(set: $someNumber += 5)

(set: $someNumber += ($someText)'s length)

there’s a lot you can dig into with Twine/Harlowe - it’s a surprisingly robust and pretty intuitive language. i can’t emphasize reading the documentation enough, though. it’s well written and pretty understandable regardless of your programming background.

I’d suggest looking at the two main story formats Harlowe and Sugarcube before starting. The two have different formats and converting part way though a project is not easy.

Harlowe tries to achieve a sort-of-english syntax. That may seem easier to begin with, but I feel (like other languages of this type) it gives a false sense of security. You’ll be learning basic programming concepts, but in a verbose way.

Sugarcube doesn’t hide that it is a programming language. While it may seem more awkward to begin with, you’ll be picking up programming concepts that will help if your game becomes complex enough to need to get into the underlying Javascript. Sugar cube also has an excellent in-game debugger.

Twine has some gotcha’s due to the way passages work once they get into the world of HTML/JS. To keep life simple I’d avoid using the techniques that hide and reveal parts of a passage dynamically.

Whichever way you go I’d suggest the first focus should be getting your mechanics/variables working before writing a lot of story/text. As this is your first game I’d recommend starting with something small and well defined first to get the basics, rather than embark on something epic.

Be aware there are limitations to the Twine editor; it becomes unwieldy for large and complex stories with many passages. A tool called Tweego can be used to generate Twine games from many passage files.


Ok i feel the need to clarify a few things on the topic of “Twine Games” to people considering using twine or may have already started using twine to make a “Twine Game”. I feel its important for everyone to understand the building blocks that make up a twine game and their roll.

First i think that “Twine Game('s)” is miss leading since Twine itself is a simple html cyoa story builder. It is not a game engine or involves any programming. It simply allows you to makes pages of a story and links them to other pages in html, using html and its inherent links. When people refer to a “Twine Game” they usually are referring to using Twine plus some form of html(this is what twine is using) compatible programming language or script to make a game.

Why do i think this distinction is important? Well becuse what transforms somthing from a simple story or cyoa like goosebumps to a game is the programming or scripting that does not come from twine.

So what people are explaining above is what script or language to use with twine and best practices for how to do this.

I’m pretty sure this is wrong.

Twine with one of it’s story formats (which are parsers: Harlowe, Sugarcube,… - which you have to have), offers variables, conditionals, loops, kinda-subroutines etc in passages without using any other languages. Given it’s ability to link from one passage to another (i.e. goto) it is Turning Complete in it’s own right. A valid programming language capable of making arbitrary computations; just not particularly efficient or expressive. There’s no need to dip into JavaScript to create a game; authors/developers may choose to but it is not required.

I think you’d be hard pressed to find a CS graduate who wouldn’t consider configuring a Turing Complete machine to be programming - even if you only ever use the “print” and “goto”.

Twine is a game engine in the sense that it is a programming language that facilitates making a certain kind of game easier. And, yes, a CYOA is a game.