Yarn Spinner is a tool for building interactive dialogue in games!
This is the compiler for Yarn Spinner. If you want to use Yarn Spinner in a Unity game, please see the releases page for Yarn Spinner for Unity!
Yarn Spinner is made possible by your generous patronage. Please consider supporting Yarn Spinner's development by becoming a patron!
random
, round_places
, dice
) have been moved from Yarn Spinner for Unity to the core Yarn Spinner library.format
function to the standard library.
string.Format
, but currently only accepts one parameter.format("{0}", 123)
will return the string "123".format("${0:F2}", 0.451)
will return the string "$0.45"..ysls.json
file to be lowercase. (These warnings have no impact on your Yarn script editing experience or runtime behaviour.)<<set $a = $a + 1>>
, where $a
is not explicitly declared) would crash the compiler.3.15.0
to 3.25.2
.7.0.2
to 8.0.1
.7.0.0
to 8.0.0
This is the compiler for Yarn Spinner. If you want to use Yarn Spinner in a Unity game, please see the releases page for Yarn Spinner for Unity!
Yarn Spinner is made possible by your generous patronage. Please consider supporting Yarn Spinner's development by becoming a patron!
Utility.TagLines
, which will eventually replace the now deprecated AddTagsToLines
method.Program.LineIDsForNode
, which allows you to get the list of all line IDs in a node.format_invariant
, which formats a number as a string using the invariant culture (rather than the end-user's current culture.)
.
as a decimal point.format_invariant
will always format a value in the invariant culture, making it useful for situations where a number needs to be embedded in a command (which expects all numbers to be ), and not shown to the user.format_invariant
like this:
<<set $gold_per_turn = 4.51>>
// de-DE: 'give_gold 4,51'
// en-US: 'give_gold 4.51'
<<give_gold {$gold_per_turn}>>
// de-DE: 'give_gold 4.51'
// en-US: 'give_gold 4.51'
<<give_gold {format_invariant($gold_per_turn)}>>
<<declare $var>>
).<<{0}{""}>>
) would resolve to unexpected final values (<<>>
).Utility.AddTagsToLines
method as obsolete.This is the compiler for Yarn Spinner. If you want to use Yarn Spinner in a Unity game, please see the releases page for Yarn Spinner for Unity!
Yarn Spinner is made possible by your generous patronage. Please consider supporting Yarn Spinner's development by becoming a patron!
Get excited! Yarn Spinner 2.3 is here! Here’s an outline of what’s new since the previous release, 2.2.
{
"projectFileVersion": 2,
"sourceFiles": ["**/*.yarn"],
"excludeFiles": ["DontInclude.yarn"],
"baseLanguage": "en",
"localisation": {
"en": {
"assets": "./voiceover/en/"
},
"de": {
"strings": "./de.csv",
"assets": "../voiceover/de/"
}
},
"definitions": "Functions.ysls.json",
"compilerOptions": {}
}
projectFileVersion
is used to identify which version of the project file format is being used, and is currently required to be the number 2.sourceFiles
is an array of search paths used to find the Yarn files that should be compiled as part of this project. Glob patterns, including globstar, are supported.excludeFiles
(optional) is an array of search paths used to find Yarn files that should not be compiled. The same kinds of patterns as sourceFiles
are supported.baseLanguage
is a IETF BCP 47 language tag indicating the language that the source scripts are written in (for example, en
for English.)localisation
(optional) is a dictionary containing zero or more objects that describe where locale-specific resources can be found, where the key is a language tag and the value is an object of the following layout:
strings
: The path to a file containing the localised line text for the project. (This is typically, but not required to be, a CSV file.)assets
: The path to a directory containing the localised assets (for example, voiceover audio) for the project.definitions
(optional) is the path to a JSON file containing command and function definitions used by the project.compilerOptions
(optional) is an object containing additional settings used by the Yarn Spinner compiler.if
statements must now all be at the same level of indentation as they’re corresponding else
, elseif
, and endif
statements.
if
statement is at a different indentation level to its corresponding statements, a compiler error will now be generated./ With indentation
<if $something>>
A line!
<else>>
A different line!
<endif>>
/ Without indentation
<if $something>>
line!
<else>>
different line!
<endif>>
/ With indentation
<if $something>>
line!
<else>>
different line!
<endif>>
-> A
-> B
-> C
-> D
LineHandler
CommandHandler
NodeStartHandler
NodeCompleteHandler
DialogueCompleteHandler
OptionsHandler
remains not optional, and is required to be set.This is the compiler for Yarn Spinner. If you want to use Yarn Spinner in a Unity game, please see the releases page for Yarn Spinner for Unity!
Yarn Spinner is made possible by your generous patronage. Please consider supporting Yarn Spinner's development by becoming a patron!
tags
header was stored.The Yarn Spinner compiler's indentation tracking has been rewritten to be more consistent in how it works.
if
statements must now all be at the same level of indentation as their corresponding else
, elseif
, and endif
statements.
This was already strongly encouraged for readability, but is now a requirement.
If an if
statement is at a different indentation level to its corresponding statements, a compiler error will now be generated.
The lines and other content inside an if
statement can be indented as much as you like, as long as it's not less indented than the initial if
statement.
For example, the following code will work:
// With indentation
<<if $something>>
A line!
<<else>>
A different line!
<<endif>>
// Without indentation
<<if $something>>
A line!
<<else>>
A different line!
<<endif>>
The following code will not work:
// With indentation
<<if $something>>
A line!
<<else>>
A different line!
<<endif>>
Previously, the following code would appear as a single option group (with the options 'A', 'B', 'C', 'D'):
-> A
-> B
-> C
-> D
In Yarn Spinner 2.3 and above, this will appear as two option groups: one containing the options 'A', 'B', and another containing 'C', 'D'.
This change was made in response to user reports that the previous behaviour didn't behave the way they expected.
Node title verification now occurs at declaration time instead of code generation. This means invalid titles will be caught and presented as a problem earlier on, to aid in debugging issues.
Code completion in the Language Server has been completely rewritten. It is now much less flexible, but way more performant. For most situations, the changes will not be noticeable.
Fixed a crash in the Language Server when encountering declaration statements without a variable.
This is the compiler for Yarn Spinner. If you want to use Yarn Spinner in a Unity game, please see the releases page for Yarn Spinner for Unity!
Yarn Spinner is made possible by your generous patronage. Please consider supporting Yarn Spinner's development by becoming a patron!
NodeInfo.PreviewText
no longer removes comments from the preview.Assert
tests to Fluent Assertions.plural
and ordinal
tags) would not work correctly with country-specific locales (for example "en-AU").This is the compiler for Yarn Spinner. If you want to use Yarn Spinner in a Unity game, please see the releases page for Yarn Spinner for Unity!
Yarn Spinner is made possible by your generous patronage. Please consider supporting Yarn Spinner's development by becoming a patron!
This is the compiler for Yarn Spinner. If you want to use Yarn Spinner in a Unity game, please see the releases page for Yarn Spinner for Unity!
Yarn Spinner is made possible by your generous patronage. Please consider supporting Yarn Spinner's development by becoming a patron!
This is a small release to enable core features needed by other components.
DetermineNodeConnections
that analyses Yarn files and returns a directed graph of node connections.This is the compiler for Yarn Spinner. If you want to use Yarn Spinner in a Unity game, please see the releases page for Yarn Spinner for Unity!
Yarn Spinner is made possible by your generous patronage. Please consider supporting Yarn Spinner's development by becoming a patron!
\
.This is the compiler for Yarn Spinner. If you want to use Yarn Spinner in a Unity game, please see the releases page for Yarn Spinner for Unity!
Yarn Spinner is made possible by your generous patronage. Please consider supporting Yarn Spinner's development by becoming a patron!
Yarn.Compiler.Utility.ExtractStringBlocks
function.select
marker to work with numbers: [select value=1 1=one 2=two 3=three /]
This is the compiler for Yarn Spinner. If you want to use Yarn Spinner in a Unity game, please see the releases page for Yarn Spinner for Unity!
Yarn Spinner is made possible by your generous patronage. Please consider supporting Yarn Spinner's development by becoming a patron!
DeclarationBuilder
and FunctionTypeBuilder
classes. These classes allow external libraries to construct new Declaration
and FunctionType
objects, without having to have access to the internal setters.CompilationResult.DebugInfo
now provides per-instruction positional debug information.
Compiler
class to access positional information for each instruction, which is an important first step for source-level debugging.Diagnostic
and Declaration
serializable, for easier communication with language servers and other utilities.#lastline
tag onto any dialogue line that immediately precedes a block of options.Declaration
and Diagnostic
now provide position information via a Range
object, which specifies the start and end position of the relevant parts of the document.Variable: {$myVar}
with no other uses of $myVar
.)-> Option one <<if>>
) would crash the compiler.