**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 [[twine_1.3.5_bugs|the bugs listed on this page]] are fixed as well. ===== Game engine ===== ====Syntax==== * You can now mix HTML tags and passage syntax in your story, without needing the '''' syntax. (It still remains for backwards-compatibility). * You can now use variables in place of a passage name in the link syntax - ''%%[[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 ''<>'' macro. * Also, you can write ''%%[[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 ''<>'' macro. This syntax addition should work with ''<>'' macros (but not the ''%%[img]%%'' syntax). You can set multiple variables by separating them with a semicolon. * As a shorthand for '''', 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!@@'' * Ending a line with ''\'' will cause that line break to be removed from the rendered text. This can be useful when dealing with long chains of ''<>'' macros. ====Macros==== * ''<>'' 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 ''<>''). * Added ''<>'', which undoes the effects of ''<>''. * ''<>'' can now accept arguments phrased using the link syntax, e.g: ''<>''. This saves the trouble of having to account for its inconsistent argument order. * ''<>'' and ''<>'' remove all the line breaks in the text between them. They should be used instead of ''<>'' to enclose groups of macros. * The ''<>'' macro, which can also be written as ''<>'', allows you to essentially have multiple ''<>'' macros chained together, without needing to nest each of them within the ''<>'' / ''<>'' tag pair of the other. * You can also use variables in place of a passage name in ''<>''. For instance, ''<>'' is now valid. ====Shorthand macros==== * You can now write a shorthand form of ''<>'' like so: ''<<$variable>>.'' Note that this only works for printing just variables - not functions or anything else. * You can now write a shorthand form of ''<>'' like so: ''<>''. 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. * You can supply additional arguments to the shorthand ''<>'' macro - in effect, you can "call" passages as if they were macros. (Note: you cannot supply arguments to the longhand ''<>'' because they will be interpreted as part of the passage name - for instance, ''<>'' will try to display "Cellar 2" instead of "Cellar" with an argument of 2.) ====Macro syntax/functions==== * You may now use "to" in macros instead of "=", and "is" instead of "eq". I think we can all agree it's too easy to confuse "=" with "eq", so you can instead write ''<>'' for more readable code. * Strings containing 'and', 'or', '$' and other Twine operator symbols can be used inside macros without them changing into Javascript symbols. * Now you can put greater-than signs inside macro tags, such as ''<">>'' * All new variables are now 0 by default, regardless of whether you've ''<>'' them or not. * Added ''either()'', a function that randomly picks one of the things given to it. * Added ''visited()'', a function that returns the number of times you've visited the given passage. * Added ''previous()'', a function that returns the name of the previous passage visited. * If this passage is being included by a shorthand ''<>'', 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. ====Macro coding==== * ''setTransitionCSS()'' replaces the contents of the #transitionCSS