This is an old revision of the document!
This page is written by Leon Arnott and is separate from the Twine documentation.
To demonstrate a number of new features and coding techniques introduced in Twine 1.4, I've made a number of example .tws files.
This file demonstrates how, by using the visited() function inside the <<if>> macro, the player's state can be tracked without using any variable. A “no-variable” Twine game can, for simple games, be easier and more fluent to write, due to not requiring the use of <<set>>.
This file shows how, by using the <<display>> macro's shorthand, the parameter() function, and, optionally, the nobr tag, you can write passages and invoke them as if they themselves were macros. The example code shows a basic use-case: creating a macro that varies the player's pronouns depending on their initial choice.
This file contains a number of stylesheets that have tags. These tags cause the stylesheets to only apply their CSS to passages with the same tag. You can use this to give specific passages a unique style. This example also shows how multiple tags can be used to combine multiple styles in the same passage.
This file demonstrates a number of CSS transitions that can be added to your Sugarcane story. These are stylesheets that use the "transition" tag to signify that they should override Twine's default fade-in transition. This example also uses tags to allow each stylesheet to be viewed individually by the player.
This file provides a basic example of the <<remember>> and «forget» macros in use.