Twine 1.4 is a major Twine release. Here is a long list of new features and changes it has compared to Twine 1.3.5.
Note that in addition to the changes below, all of the bugs listed on this page are fixed as well.
<html>
syntax. (It still remains for backwards-compatibility).[[Exit|$placeName]]
now creates a link to the passage whose name is in the $placeName variable. You can also do [[Back|previous()]]
to replicate the «back»
macro.[[link text|passage name][$var = value]]
to make a passage or external link that changes a variable when it's followed! The code section is treated as if it were arguments to a «set»
macro. This syntax addition should work with «choice»
macros (but not the [img]
syntax). You can set multiple variables by separating them with a semicolon.<span style=“…”>
, the TiddlyWiki inline style syntax is available. Type @@
, then list CSS style attributes separated and terminated with semicolons, then put the passage text (including any other formatting and macros) ending with another @@
. Example: @@font-size:2em; text-decoration: underline; Hello there!@@
\
will cause that line break to be removed from the rendered text. This can be useful when dealing with long chains of «if»
macros.«remember»
now uses HTML5 Local Storage, which means it can now work even in an offline HTML file. Also, it can remember multiple variables given in a compound statement (like «remember $a = 1, $b = 2»
).«forget»
, which undoes the effects of «remember»
.«choice»
can now accept arguments phrased using the link syntax, e.g: «choice [[a trapdoor?|falling]]»
. This saves the trouble of having to account for its inconsistent argument order.«nobr»
and «endnobr»
remove all the line breaks in the text between them. They should be used instead of «silently»
to enclose groups of macros.«else if»
macro, which can also be written as «elseif»
, allows you to essentially have multiple «if»
macros chained together, without needing to nest each of them within the «else»
/ «endif»
tag pair of the other.«display»
. For instance, «display $name»
is now valid.«print $variable»
like so: «$variable».
Note that this only works for printing just variables - not functions or anything else.«display “Place”»
like so: «Place»
. Note that this only works for passages whose names do NOT contain spaces. Also, it can only be done with specific named passages - not variables or anything else.«display»
macro - in effect, you can “call” passages as if they were macros. (Note: you cannot supply arguments to the longhand «display»
because they will be interpreted as part of the passage name - for instance, «display Cellar 2»
will try to display “Cellar 2” instead of “Cellar” with an argument of 2.)«set $darts to 4»
for more readable code.«set $arrow to “–>”»
«set»
them or not.either()
, a function that randomly picks one of the things given to it.visited()
, a function that returns the number of times you've visited the given passage. previous()
, a function that returns the name of the previous passage visited.«display»
, the parameter()
function returns one of the space-separated terms in the macro invocation, parsed to a value. The function's argument is a zero-based index - parameter()
or parameter(0)
returns the first parameter, parameter(1)
the second, and so forth.setTransitionCSS()
replaces the contents of the #transitionCSS <script> element with the passed string. This allows you to completely override the default transition CSS without it cascading down. I'm offering this as a JS function because many transitions will also require some extra JS, and being able to provide the complete transition code in just a script is desirable.prerender
and postrender
are new objects whose function properties are executed every time the passage is rendered. The functions added to them take one argument: the resultant .passage .content
element. Their 'this' value is the Passage object being rendered.[data-tags]
selector need not be repeated dozens of times in a stylesheet, and applying only to the 'body' or '.passage' selectors. Although, it is slightly less flexible w/r/t tag hierarchies - the :not[data-tags]
selector can't really be replicated.)The StorySettings passage enables a number of special story options to be set.
«back»
is now usable in Jonah. When used in Jonah, a «back»
link removes the contained passage, plus any prior passages (as given by the “steps” argument or a passage name argument).«back»
and «return»
macros, in Sugarcane. This means that several bugs related to these are now fixed, and they should now work alongside random macros, player-input macros, and other such things.«choice»
is now usable in Sugarcane. It now creates a link that can only be clicked once in the whole story.<noscript>
tag to alert the reader that Javascript is off.<a>
links in stories are styled as if they were proper externalLinks, in case the author unwittingly used the former in ignorance of the latter (a not uncommon occurence).«display»
macros are drawn with a bluer tint.[img[imageName]]
displays the image. Images are also embedded in the final HTML file, and don't need to be hosted elsewhere. Supported image file extensions are GIF, PNG, JPEG, SVG and WebP.