Part 6: Unfold Studio extensions to Ink
Unfold Studio currently runs on Ink 0.8.2, with a few customizations.
Include
Unfold Studio handles INCLUDE
a bit differently from Ink. For one
thing, you can only include stories that are public or shared (even if
they are your own), and stories are included by their ID, not a
filename.
The rules for inclusion are also different. In regular Ink, defining the
same knot or variable in two stories which are included together results
in an error. In Unfold Studio, knots and variables defined in included
stories are ignored if they are already defined in the including story.
When you INCLUDE
a story, only its knots and variables are included.
Any text or redirects outside of a knot are not included. This makes it
possible to write substories which work on their own, and which can also
be included in larger stories.
This behavior is achieved through a preprocessing layer story code goes through before being parsed by Ink.
External functions
Unfold Studio provides some functions which are not avialable in
standard Ink. ln(x)
and log2(x)
provide support for logarithms.
random()
returns a random float between 0 and 1.
random_integer(low, high)
returns a random integer at least low
but
less than high
. And random_gaussian(mean, std)
returns a Gaussian
(normal) random number with mean mean
and standard deviation std
.
Styling
Stories can use tags to style content. Currently, only text messages are supported:
=== texting ===
What's up? # text-them
nm. U? # text-me
Clearing the output
Some stories might need to clear the output history. You can do this with the #clear tag.
Now you see it.
+ And now...
you don't #clear