---
url: https://docs.kxtools.xyz/client/acr.md
---
# ACR: Lua API

**ACR (automatic combat rotation)** is the part of KX Client that plays your build's rotation for you. KX ships built-in builds, and you can write your own. A build is **one Lua file** that describes the skills, their priority and the conditions for each skill. The engine checks that description many times a second and casts the best skill that is ready.

* **No scripts, no timelines.** Each row of the rotation has its own live conditions, so a missed skill never blocks the rest.
* **Hot reload.** Save the file and KX loads it within about a second.
* **AI-friendly.** This guide is written so ChatGPT, Claude, Gemini or a coding agent can write the build for you.

## Quick start

### With a coding agent

Claude Code, Codex, Gemini CLI, Cursor and similar agents can do every step below by themselves. If they can, they also [test and tune the build](/client/acr/self-improving) fight after fight. Paste this one line:

```text
Read https://docs.kxtools.xyz/client/acr/agent.md and follow it. Build: <your build link>
```

### With a chat AI {#download-for-your-ai}

1. **Get the guide.** Download **[kx-acr-lua-api.md](/client/acr/kx-acr-lua-api.md){target="\_blank" download}**, the whole ACR guide as one file, written for your AI to read.
2. **Collect your build.** A build link, or the skill ids of your bar ([where to find them](/client/acr/basics#s3)). Never let the AI guess an id: a wrong one fails silently.
3. **Ask your AI.** Attach the file and paste the [prompt template](/client/acr/ai#s19) with your build filled in. The AI answers with one complete Lua file.
4. **Load it in game.** ACR window → **Editor** → **Paste**, then save it under the build's id. Or save it as `<id>.lua` in `%APPDATA%\KX Client\acr\`. No restart needed ([details](/client/acr/basics#s4)).
5. **Test and fix.** Check **Builds**: a build with errors never runs. Copy the error lines back to your AI word for word. Then turn the ACR on and attack a training golem. If it plays wrong, tell the AI what you saw.

## About this guide

Written for KX players who want to make their own ACR (automatic combat rotation), and for the AI helping them. Matches KX ACR as of 2026-11-11.

**Players: give [this whole guide as one file](#download-for-your-ai) to your AI** (ChatGPT, Claude, Gemini, ...), say which build you want, and paste the skill ids or a build link. [Section 19](/client/acr/ai#s19) has a ready-made prompt. Then load the AI's file in game as [section 4](/client/acr/basics#s4) shows. The file is long. If your AI reads files in parts, tell it to read the whole file. The reference tables and the full function list are at the end.

**An AI that works on your PC by itself** (Claude Code, Codex, Gemini CLI, Cursor and similar) can also test and improve the build by itself, fight after fight. [Section 20](/client/acr/self-improving) has the setup, the rules and the prompt for that.

> If English is not your language: give the whole file to your AI, then describe the build you want in your own language. Use numeric ids for skills and effects. The ids are the same on the Chinese and global servers.

## Pages

* **[Basics](/client/acr/basics):** how an ACR runs, ids, loading and testing, a file top to bottom.
* **[Lua API](/client/acr/api):** every `acr.*` function, node options and the expression language.
* **[Builtins](/client/acr/builtins):** every function you can call in a condition.
* **[Reference](/client/acr/reference):** professions, specs, weapons, resources, buff and agent names.
* **[Recipes and examples](/client/acr/recipes):** common patterns, common mistakes, complete builds.
* **[Working with AI](/client/acr/ai):** the AI's rules and the prompt template.
* **[Self-improving ACRs](/client/acr/self-improving):** an agent that tunes the build by itself.
