# Yarn Scripts

A Yarn script is a text file containing your dialogue.

{% hint style="info" %}
Yarn scripts need to be part of a [Yarn Project](/yarn-spinner-for-godot/godot-csharp/importing-yarn-files/yarn-projects.md) in order to be used in your game.
{% endhint %}

## Creating a New File

To create a new Yarn script in Godot, follow these steps:

* Open the Project menu, and choose Tools > YarnSpinner -> Yarn Script.
* Choose a directory and filename for the new Yarn script in the dialog that appears.

![Creating a new Yarn script.](/files/Q5csx1GucYEhHpQzW19r)

The new file that you've just created will contain a single [node](https://github.com/YarnSpinnerTool/YSDocs/blob/main/docs/getting-started/writing-in-yarn/lines-nodes-and-options.md#writing-nodes-in-plain-text), which has the same name as the file.

{% hint style="info" %}
Creating a Yarn Script in Godot is exactly the same as creating a `.yarn` file externally (i.e. in macOS Finder or Windows Explorer), and dragging it into the directory of your Godot project.
{% endhint %}

## Editing Yarn Scripts

You can edit .yarn scripts with the text editor of your choice. To open your editor from within Godot, ensure that you have associated .yarn files on your computer with your desired editor. Then, right click a .yarn script in the Filesystem panel and click Edit in External Program. When you save your changes and return to Godot, it will be re-compiled.

{% hint style="info" %}
You can learn about our recommended editor, Visual Studio Code with the official Yarn Spinner Extension at: [https://github.com/YarnSpinnerTool/YSDocs/blob/main/docs/getting-started/editing-with-vs-code/README.md](https://github.com/YarnSpinnerTool/YSDocs/blob/main/docs/getting-started/editing-with-vs-code/README.md "mention").
{% 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/yarn-spinner-for-godot/godot-csharp/importing-yarn-files/yarn-scripts.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.
