Writing Commands

VNKit’s Commands are ordinary Yarn Commands. Each one is the Command’s name, then what it acts on, then one value:

<<move capsley left>>
Moving Capsley to the left slot.

This moves Capsley to the left slot. Each Command does one thing, so changing several things about a character takes several short Commands. For example, a character’s nameplate colour, name colour, and nameplate position are three separate Commands:

<<nameplate c 4f63c2>>
<<name_colour c ffffff>>
<<nameplate_position c left>>
Three Commands that set up one character’s nameplate.

How long a Command takes

Every Command can end with a duration, in seconds:

<<move capsley left 0.5>>
Moving Capsley over half a second.

This moves Capsley to the left slot over half a second. If you leave the duration out, the change happens instantly.

The story waits for each Command to finish before it carries on. In the example above, the next line appears after Capsley has finished moving.

pop and shake can’t be seen without a duration. If you leave it out, VNKit warns you in the Console.

Running Commands at the same time as the story

Put nowait after the duration, and the story carries on straight away while the Command plays out:

<<show witch neutral 1 nowait>>
w: You're not the only one here, salesman.
The Witch fading in while her line is shown.

Here, the Witch fades in over a second while her line is shown.

nowait always comes after a duration. Without a duration, the change is instant, so there’s nothing to wait for. If you write 0 nowait, VNKit warns you in the Console.

Don’t write nowait in place of the duration, as in <<show witch neutral nowait>>. In most Commands, Yarn Spinner tries to read nowait as the duration, the Command doesn’t run, an error appears in the Console, and the dialogue stops. emphasise and deemphasise are the exception: they only warn you in the Console.

Waiting for something to finish

<<wait_for target>> waits until something you started with nowait has finished:

<<move capsley off_left 1 nowait>>
d: He left his yarn behind.
<<wait_for capsley>>
<<hide capsley>>
Waiting for Capsley to finish leaving before hiding him.
TargetWaits for
A character’s name, like capsleyAnything happening to that character.
A slot, like leftAnything happening to the character in that slot.
A stage’s nameThe stage being raised, switched to, or faded.
backgroundA background change.
maskThe mask being started, moved or ended.
emphasisemphasise or deemphasise.
textboxhide_textbox.
musicA music change, fade or volume change.
ambienceAn ambience change, fade or volume change.
soundA sound effect fading in, or stop_sound.
allEverything started with nowait.
What wait_for can wait for.

If nothing is happening to the target, wait_for carries on straight away.

When animations finish early

If you give a Command to something that’s still moving from an earlier nowait, the earlier animation jumps to its end first, then the new one starts.

Anything started with nowait also jumps to its end when a node finishes, when the dialogue ends, and before the game saves.

Writing names and words

  • Words don’t need quotes. Text with spaces in it does, like <<show sylvie "green smile">>.
  • American spellings work too: bg_color, name_color, emphasize, deemphasize, and center do the same thing as bg_colour, name_colour, emphasise, deemphasise, and centre.
  • Yarn removes quotes before VNKit sees a Command, so VNKit can’t tell left and "left" apart. A character named after a slot, like left or far_right, or a character named all, is treated as the slot or keyword.

Autocomplete

VNKit comes with VNKit.ysls.json, which tells the Yarn Spinner editor about every VNKit Command. With it, the editor autocompletes Commands as you type, and warns you when one is missing something. See Adding VNKit to Your Project to set it up.

Next step Characters Showing, moving and changing characters, and the slots they stand in.