Twine Guide: SugarCube Basics (Part 1)
Added 2022-04-19 00:23:23 +0000 UTCA new SugarCube tutorial is here! As per the bonus content vote this month, this one is about the fundamentals of SugarCube and all the basic building blocks of a Twine game. Because there was more to cover here than I anticipated, this tutorial only deals the mechanical side of SC. It does not go into design elements or using HTML/CSS in your game.
Included in Part 1:
- Switching formats and keeping SugarCube up-to-date
- Useful things to know before you start coding (important if you've never coded before!)
- Introduction to variables and variable types
- How to set variables
- How to use links, buttons and image links
- Conditional statements
- Special passages, including StoryInIt
- Tag and tag-based passages
- Dialog boxes
- Using and populating the UI Bar (the game menu)
- How game history works
- How to remove the forward/backward buttons
- How to change the amount of saves, let players name their own saves, and add autosave
- Brief overview of the Settings API
- Widgets
- Useful macros and functions like hasVisited, <<include>>, <<nobr>> and <<linkreplace>>
- How to make return links for game menus so you don't get stuck in a loop
- How to use the SugarCube debug tool
- The SugarCube validator tool
Due to its length, this tutorial is available as a downloadable PDF. There's 40 pages of guides, examples, and sample code (and there is a table of contents!). I've also updated the Twine Guidebook HTML file to include some demos and sample code of the elements discussed in the tutorial. You can download the HTML file and open it in your browser, or pop it into the Twine editor and poke around.
Happy coding! π