> 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/start/first-script.md).

# Your first script

A simple script with settings, how to build it and load it into Quick.

In this lesson we write a script that jumps automatically every few ticks. It has settings, so you can see how they show up in the menu.

Every script is a class that extends `Script`. Everything Quick can do is available right from it: `player()`, `chat()`, `control()` and others. You do not need to import any managers.

```java
package my;

import hex.script.api.CheckBox;
import hex.script.api.Render2D;
import hex.script.api.Script;
import hex.script.api.Slider;

public class AutoJump extends Script {

    private final CheckBox onlyOnGround = checkBox("Only on ground", true);
    private final Slider every = slider("Every N ticks", 10f, 1f, 40f, 1f).postfix("t");
    private int ticks;

    @Override
    public String description() {
        return "Jumps automatically";
    }

    @Override
    public void activate() {
        ticks = 0;
    }

    @Override
    public void onTick() {
        if (++ticks < every.intValue()) return;
        ticks = 0;
        if (!onlyOnGround.value() || player().onGround()) {
            control().jump();
        }
    }

    @Override
    public void onRender2D(Render2D render) {
        render.drawClientText("AutoJump: " + ticks, 5f, 5f, 7f, render.themeColor("text"));
    }
}
```

## How it works

* The checkbox and the slider are declared as class fields. Quick shows them in the menu and saves their values.
* `activate()` is called when the script is enabled. This is where the counter is reset.
* `onTick()` is called 20 times per second while the script is enabled.
* `onRender2D` draws text in the corner of the screen every frame.

## Building the jar

The code goes into the `java/` folder, under a path that matches the package. Images and other files, if you have any, go into `resources/`:

```
AutoJump.jar
  java/my/AutoJump.java
  resources/icon.png
```

A jar is a regular zip archive with a different extension. You do not need to compile anything, Quick builds the sources itself. A manifest is not needed either.

Put `AutoJump.jar` into the scripts folder. After about a second it appears on the Scripts tab, and you can enable it.

A jar can contain any number of classes. Each `Script` subclass becomes a separate script in the menu.

To set up an IDE so the jar is built automatically, see [Setup](/en/start/ide.md).

## If something does not work

Compilation errors are shown in the script console (the button in the Scripts tab header) and in chat. The message includes the file, the line and the compiler error.

If one file has an error, the other scripts still load. The console shows a line saying how many files failed to build and that the rest were loaded.

If a script crashes while running, Quick disables it and writes the reason to the console. The game does not crash.

## What happens on load

The order in which Quick processes a jar:

| Step         | What happens                                                                                    |
| ------------ | ----------------------------------------------------------------------------------------------- |
| reading      | the jar is read in full and closed right away, so you can overwrite it at any time              |
| compilation  | all `.java` files from all jars are compiled together                                           |
| checking     | Quick checks the code against the sandbox rules, see [Sandbox and limits](/en/extras/limits.md) |
| resources    | files from `resources/` become available to the game                                            |
| mixins       | if `mixin/` changed since the game started, "Restart required" appears                          |
| registration | the script appears in the menu and its settings are restored                                    |

## Name and description

| Method          | Type     | Description                                                 |
| --------------- | -------- | ----------------------------------------------------------- |
| `name()`        | `String` | name in the menu; if not overridden, the class name is used |
| `description()` | `String` | description shown in the menu and in `.script list`         |

## Hot reload

Quick watches the scripts folder. Once a jar is saved and the file stops changing, all scripts are reloaded. Settings are kept, and enabled scripts stay enabled.

To reload scripts manually, use `.script reload` or the "Reload" item in the "···" menu.

Mixins cannot be reloaded this way. After changing them you need to restart the game. See [Mixins and hooks](/en/extras/mixins.md) for details.


---

# 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/start/first-script.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.
