# Commands

In Yarn Spinner, you can send instructions to your game through **commands**. Commands look like this:

```yaml
<<wait 2>>
<<setsprite ShipName happy>>
<<fade_out 1.5>>
```

Commands are sent to your game's [Dialogue Runner](https://docs.yarnspinner.dev/components/dialogue-runner), just like lines and options are. Commands are not shown to the player directly; instead, they're used for things like stage directions.

Yarn Spinner comes with some **built-in commands**; however, to get the most usefulness out of them, you'll want to [define your own custom commands](https://docs.yarnspinner.dev/yarn-spinner-for-unity/creating-commands-functions) that make your game do what you need to.

## Built-in Commands

There are two built-in commands in Yarn Spinner: `wait`, and `stop`.

### `wait`

The `wait` command pauses the dialogue for a specified number of seconds, and then resumes. You can use integers (whole numbers), or decimals.

```yaml
// Wait for 2 seconds
<<wait 2>>

// Wait for half a second
<<wait 0.5>>
```

### `stop`

The `stop` command immediately ends the dialogue, as though the game had reached the end of a node. Use this if you need to leave a conversation in the middle of an `if` statement, or a shortcut option.

```yaml
// Leave the dialogue now
<<stop>>

// Leave the dialogue if we don't have enough money
<<if $money < 50>>
    Shopkeeper: You can't afford my pies!
    <<stop>>
<<endif>>
```

## Making Your Own Commands

You can create your own commands, so that your scripts can send directions to your game. For more information on how to create them in Unity games, see [Creating Commands and Functions](https://docs.yarnspinner.dev/yarn-spinner-for-unity/creating-commands-functions), in the Yarn Spinner for Unity section of the documentation, and equivalents for other engines.

{% hint style="danger" %}
We recommend that you only move into the Yarn Spinner for Unity documentation after learning the fundamentals of Yarn Spinner Scripting.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.yarnspinner.dev/write-yarn-scripts/scripting-fundamentals/commands.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
