Appearance
Working with AI
The rules your AI follows and the prompt to give it. For an agent that tests the build by itself, see Self-improving ACRs.
1. For the AI: rules
Follow these every time you write or change a KX ACR.
- Output one complete Lua file that follows this document. When you change a file, send the whole file again, not a diff.
- Use only what this document lists. Every
acr.*function and node method is in sections 6-14. Every function you may call inside a condition is in section 22. Never invent one. If you can't express something, say so plainly. Don't fake it. - Never guess a skill, trait, buff or specialization id. Use ids the player gave you, or ids you looked up from the sources in section 3. Put every id in
acr.constunder a readable NAME and write the skill name in a comment. If an id is missing, ask for it, or list it under "ids to check" at the end of your answer. A wrong id fails silently: that row simply never casts. - Write a dynamic priority rotation, never a script. Each row has its own live conditions (ready, recharge, charges, resources, buffs, weapon set, target). A skill that was missed or is unavailable must never block the rest. Don't use step counters that only advance after a particular cast, and don't use fixed timelines. An opener may be a short group of guarded rows, but every row in it must be skippable, and the main rotation must always run once in combat (recipe 16.1).
- Conditions are strings in the KX expression language, not Lua. Use
&&,||,!,==and!=(neverand,or,notor~=). Inside a condition, write constants bare (ready(GS_2)). In Lua code, write them asC.GS_2. - Units: time in milliseconds, distance in game units (a range-1200 skill reaches 1200). Health from
hp()andtarget_hp()is a fraction from 0.0 to 1.0, so "below 50%" istarget_hp() < 0.5. - Auto-attack chains: list every step in one row,
skill { C.AUTO_1, C.AUTO_2, C.AUTO_3 }. With only the first id, the row stops matching after one hit. - Skills with several ids: many skills have more than one id (PvE/PvP versions, trait variants, kit or attunement versions). When you are not sure which one the bar shows, list them all in the row itself,
skill { C.A, C.B }. Only the one actually on the bar casts. In conditions (ready,cd,on_bar, ...), use only the one id the bar shows. A variant you never cast can read as ready forever, soready(A) || ready(A_ALT)may never turn false. - Range and facing: give damage skills
:range(), and add:facing()for skills that hit in front (16.11). Ground-targeted skills land on the target by default.:ground(...)changes that.:ground("minimize"):range():radius()aims at the near edge of the target's hitbox (16.12). - Know which bar you are on. Gate each weapon set's group with
on_weapons(MAIN, OFFHAND). Kits, shrouds, forges, tomes and attunements replace the bar. Inside an Engineer kit,on_weaponsis false for every set. Inside the other replacement bars, you can't rely onon_weaponseither. Give each of those bars its own group gated withon_bar(<a skill in slots 1-5 of that bar>), for example its auto-attack, and add!in_kit/!in_shroud-style conditions to the weapon groups (recipe 16.2). Don't detect a bar by the F-key skill that enters or leaves it (Engage/Deactivate Photon Forge, Exit Shroud): use a skill 1-5 of the bar. Leave a kit with its stow skill, never withswap(). - Costed skills: in game,
ready()checks recharge and charges only. Gate initiative, adrenaline or energy costs yourself, for exampleres(INITIATIVE) >= 5. - Ids and keys: the build
idis unique snake_case andorigin = "user". Begin toggle keys with the build id so they never clash. Don't reuse a built-in build's id unless the player wants to replace that built-in. - Don't write
library = ...,run_legacy(...),can_run_legacy(...),legacy_*oracr.visual { ... }. Some built-in builds the player may show you contain them. They exist only so builds imported from older formats keep working; new builds don't use them. - Answer in the player's language. Lua and expressions stay as written here.
- Switches and break bars: give every skill except the auto attack a toggle, on by default. When a toggle is off, make every condition that waits for that skill treat the skill as used, so nothing else stalls. Put every CC skill of the build (stuns, dazes, knockbacks, launches, pulls, fears, taunts, moa) in the break-bar phase (recipe 16.6). Give each CC skill a single toggle with
section = "CC". All rows of that skill use this one toggle, in the break-bar phase and in the rotation. A CC skill the player switched off must never cast. - After the file, explain in a few short lines what the rotation does each tick: which groups exist, what wins and when it swaps. Then list the toggles and the ids to check.
- If you can run programs and read and write files on the player's PC, you can test and improve the build yourself. Section 20 says how. If you cannot, never claim that you tested anything.
19. Prompt template
Copy this into your AI together with this file:
text
Write a KX ACR for Guild Wars 2 in Lua, following the attached "KX ACR: Lua API" exactly.
Build: <paste a gw2skills.net / Snow Crows / Hardstuck link, or describe it>
Profession and elite specialization: <e.g. Warrior / Berserker>
Weapons: set 1 <...>, set 2 <...>
Heal, utilities, elite: <names, ids if you have them>
How to play it: <paste the guide's priority list or rotation notes>
Skill ids: <paste ids from the in-game picker, or "look them up in the official GW2 API">
Switches I want on the Skills page: <e.g. "use Rush", "CC skills on/off">
Rules: dynamic priority rotation (no step-by-step script), never guess ids,
one complete .lua file. After it, explain the priorities in a few lines and list
any ids I should check.When the ACR shows errors:
text
KX says:
<paste the error lines>
Fix the file and give me the whole file again.When it loads but plays wrong, describe what you saw: "it never uses X", "it swaps too early", "it stands still after one auto attack".
An AI that works on your PC by itself uses the prompt in section 20.6 instead.
Using a coding agent
An agent that can run programs on your PC (Claude Code, Codex, Gemini CLI, Cursor and similar) needs only one line. It downloads this guide by itself. If it can, it also tests and tunes the build:
text
Read https://docs.kxtools.xyz/client/acr/agent.md and follow it. Build: <your build link>