> For the complete documentation index, see [llms.txt](https://docs.quickclient.cc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.quickclient.cc/en/settings/storage.md).

# Saving data

Keeping your own script data between launches.

Quick saves setting values by itself. For other data, such as a counter, a list or coordinates, there is `Storage`. It is a file with key-value pairs, and each script has its own.

```java
int runs = storage().getInt("runs", 0) + 1;
storage().put("runs", runs).save();

Storage bases = storage("bases");
bases.put("home", List.of("120", "64", "-40")).save();
```

## How it works

* The first two lines count how many times the script has run: they read the value, add one and write it to disk right away.
* Then the home coordinates are saved as a list into a separate `bases` config.

The files are stored in `scripts\.data\<script>\<name>.txt`. `storage()` without arguments opens the config named `storage`, and `storage(name)` opens the config with the given name. All values are stored as strings, and numbers and lists are parsed when you read them.

## Reading

| Method                      | Type           | Description                                                     |
| --------------------------- | -------------- | --------------------------------------------------------------- |
| `name()`                    | `String`       | config name                                                     |
| `has(key)`                  | `boolean`      | whether the key exists                                          |
| `get(key, fallback)`        | `String`       | string or the fallback                                          |
| `getInt(key, fallback)`     | `int`          | integer; the fallback if the key is missing or is not a number  |
| `getLong(key, fallback)`    | `long`         | long integer                                                    |
| `getDouble(key, fallback)`  | `double`       | decimal number                                                  |
| `getBoolean(key, fallback)` | `boolean`      | boolean value                                                   |
| `getList(key)`              | `List<String>` | list written with `put(key, List)`; empty if the key is missing |
| `keys()`                    | `List<String>` | all keys                                                        |

## Writing

| Method                   | Type      | Description                                                   |
| ------------------------ | --------- | ------------------------------------------------------------- |
| `put(key, String)`       | `Storage` | write a string; `null` removes the key                        |
| `put(key, long)`         | `Storage` | write an integer                                              |
| `put(key, double)`       | `Storage` | write a decimal number                                        |
| `put(key, boolean)`      | `Storage` | write a boolean value                                         |
| `put(key, List<String>)` | `Storage` | write a list                                                  |
| `remove(key)`            | `Storage` | remove a key                                                  |
| `save()`                 | `Storage` | write to disk                                                 |
| `clear()`                | `Storage` | clear in memory; the data disappears from disk after `save()` |

Write methods return the same config, so they are usually chained: `put(…).put(…).save()`. Without `save()` the changes last only until scripts are reloaded.

## What is saved automatically

* Values of all settings from [Kinds of settings](/en/settings/types.md), by their `id()`. If you plan to rename a setting, give it an `id("…")`.
* Whether the script is enabled or disabled. It stays the same after a reload and a game restart.
* The value of a `Custom` entry, if `persist(write, read)` is called on it.

All of this is written when the script is disabled, on reload and when you exit the game.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.quickclient.cc/en/settings/storage.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
