This is a description of the yarn passage format.
Links
A Yarn link is of the form [[destination|display text]].
If this order is counter-intuitive to you, see 'linksilly' on the js api page. Please don't do this.
Javascript
You can insert raw Javascript by beginning a line with $.
You can insert a block of raw Javascript by putting ${ on a line by itself, followed by the script, followed by $} on a line by itself. This is equivalent to putting $ before each line of the script.
$ lines, and ${ and $} don't introduce any vertical space. For example:
This is
$ // some js...
${
// some more js...
$}
a test. And here:
$ // ...
is a space.
Produces this output: (providing the script doesn't write() anything)
This is a test. And here: is a space.
Very Small Example Game
[[start]]
You look around slowly. $ save.eyehp = 5; It feels like [[hello|someone is watching you]].
[[hello]]
Surprise, it was me! But I am just a friendly disembodied eye. (: [[attack|Hit the eye]].
[[attack]]
${
save.eyehp -= Math.random() * 3;
if (save.eyehp <= 0)
write('O! O! O! O! O! I am dead.');
else
write('Ouch! But I\'m still alive! :D \n\n [[attack|NO MERCY]].');
$}