Let AI Write Super Macros
Let AI Write Super Macros
You don't need to know Lua. Copy the handoff prompt below to an AI (ChatGPT, DeepSeek, Claude, Doubao, etc.). The AI will first read the Heitu Super Macro documentation, then help you write a new macro or fix an existing one.
Tips
The handoff prompt deliberately does not hard-code the Super Macro function list. It asks the AI to use the documentation as the source of truth every time, so you don't need to update the prompt when the docs change.
Warning
AI can help you write code, but it cannot guarantee the macro will work on the first try. You must test it in game. Spell IDs, client version, and key binding can all affect the result.
What the handoff prompt can do
- Write a Super Macro from scratch according to the docs
- Fix a Super Macro that does not run, does nothing, or behaves incorrectly
- Judge whether an idea can be implemented with Super Macro
- Explain whether a function/field is available in the current version
- Split long logic into "Heitu editor function + in-game call macro"
Why not just ask AI directly
Ask an AI to "write me a WoW macro" and it will often make things up from memory:
- Invent non-existent functions such as
UnitHealthorGetSpellCooldown - Mix Super Macro functions with native WoW APIs
- Guess spell IDs, field names, and event names
- Write code that looks usable even when the docs say it cannot be done
The handoff prompt blocks these paths: read the docs first, decide feasibility first, say "not possible" when it is not possible, and only use documented capabilities.
How to use it
Step 1: Copy the complete handoff prompt
Scroll to the complete handoff prompt and click the copy button in the upper-right corner of the code block.
Don't copy only half of it, and don't edit the rules. Those rules are what stop the AI from making things up.
Step 2: Send it as the first message
Open an AI that supports long text and send the handoff prompt as the first message.
Don't send your request first. Let the AI read the docs and confirm its understanding.
Step 3: Confirm the AI actually read the docs
Normally, the AI will reply with something like:
Documentation read. I confirm: in-game macros use a fixed command to execute Lua; functions, events, and version differences follow the docs; feasibility first; if something cannot be done, I will say so...
If the AI starts writing code immediately, it is not following the handoff prompt. Remind it:
Please read the docs according to the handoff prompt first, confirm the key constraints in no more than 5 lines, and wait for my request.
If the AI says it cannot open the links, paste the documentation content to it:
- Must paste: Getting Started
- Must paste: Registering Events
- For examples, paste only the one related to your request
And tell it explicitly:
This is the original documentation. Judge only by the functions and fields in it; do not fill in from memory.
Step 4: Describe your request like a normal conversation
No form to fill in. Just say what you want. To save a few rounds of questions, it helps to mention:
- Client/server version
- Class/specialization
- The effect you want
- Trigger method: press once, repeated presses, or event callback
- Spell IDs you know; it's fine if you don't know them
- For a fix, paste the complete code and the current error
Example:
I'm a 3.3.5 warrior. I want a macro that uses Execute when the target is below 20% health and Bloodthirst otherwise, triggered by pressing once. I'm not sure about the spell IDs.Tips:
- When fixing a macro, paste the complete code, not just one line. Make it clear whether it is an in-game macro or an editor function.
- Paste the complete error message from game chat, not just "it doesn't work".
- If you don't know the spell ID, that's fine. Ask the AI how to confirm it using the documentation's diagnostic method.
- Do one macro at a time. Ask separate questions for separate requests so the AI doesn't miss anything.
Step 5: Read the feasibility verdict first
The AI's answer should start with:
Feasibility: Yes / Partially / No / Needs confirmation
Basis: ...How to handle each verdict:
- Yes: continue reading the code and explanation.
- Partially: read the "cannot do" part and decide whether you can accept it.
- No: don't push it to "think of something". Ask for the closest documented alternative, or change the request.
- Needs confirmation: answer its questions, especially version, spell IDs, and trigger method.
If the AI says "should work" or "theoretically works" without a basis, remind it:
Per the handoff prompt, compare each requirement against the documented functions and give a feasibility verdict; if the docs don't provide a capability, say it cannot be done.
Step 6: Put the code in the right place and test it
AI output usually falls into two categories:
- In-game macro: one line, placed in a game macro and bound to a key.
- Editor function: multiple lines, placed in Heitu software → Super Macro editor, saved and synced; the in-game macro only contains the call line.
Putting it in the wrong place is the most common reason for "nothing happens". See the "Standard Format" section in Getting Started.
Testing tips:
- Confirm the client version using the documentation's version query method.
- If unsure about a spell ID, capture it using the documentation's spell ID diagnostic method.
- Use
Say/printto output intermediate values and confirm the correct branch is taken. - For event macros, test whether the event fires first, then test the full logic.
- Paste new errors or incorrect behavior back to the AI so it can continue with the same context.
Complete handoff prompt
Copy everything from # Role below to the last line and send it to the AI as the first message.
Tips
The "Lua runtime" section in the handoff prompt lists fixed Lua 5.1 capabilities provided by the VM. It does not change with the Super Macro docs. The AI still reads the docs for Super Macro-specific functions. The handoff prompt below is in English; the linked documentation is currently in Chinese and remains the source of truth.
# Role
You are a "Heitu Super Macro" script engineer. A Super Macro is a macro that executes Lua code in the World of Warcraft chat box using a fixed command. The exact command format, available functions, events, fields, and version differences are all defined by the official Heitu documentation.
I will give you one of two things:
- A. A Super Macro that does not run or behaves incorrectly, and ask you to fix it.
- B. A requirement, and ask you to write it according to the docs.
# Principle 1: The documentation is the only source of truth for Super Macro APIs
- This prompt deliberately does **not** list Super Macro functions, parameters, return values, fields, events, or version differences, because those change with the docs.
- Read the documentation before answering. All Super Macro function names, shorthand names, parameter order, units, return values, field names, event names, and version limits must follow the documentation you read this time.
- Do not fill in from memory, do not guess, and do not use "should / usually / theoretically" in place of confirmation.
- If the documentation does not provide a capability, treat it as "does not exist / not possible / needs confirmation".
- If the function reference and the example code conflict, the function reference / parameter description wins; examples are only for style.
- If you rely on a specific page/section, say which one, so I can verify it.
Note: The Lua language and Lua standard library are not part of the Super Macro API; they are provided by the VM as described below. Super Macro-specific game query/action functions must still come from the docs.
# Principle 2: Decide feasibility first; never invent
Before writing code, answer: can this requirement be done using only the functions, events, and fields in the documentation?
How to decide:
1. Split the requirement into "game data to read", "game actions to perform", and "pure Lua computation".
2. For game data and actions, find the corresponding item in the documented function list, parameter descriptions, field tables, and event list.
3. Pure Lua computation (strings, tables, math, loops, conditions) may use the Lua standard library; no Super Macro function is needed.
4. All found -> "Yes"; partially found -> "Partially"; none found -> "No"; documentation unclear or version difference causes uncertainty -> "Needs confirmation".
5. Judge each sub-requirement separately; do not say the whole thing is possible just because part of it is.
Hard rules:
- Do not invent functions, events, fields, or parameters; do not treat native WoW APIs, other addon APIs, or memory/network operations as Super Macro capabilities.
- Do not use `io`/`os`/`debug`/network access/memory access/external tools to bypass documentation limits.
- Every condition must trace back to a documented function return value or documented field; do not rely on guessed timing, animation, or internal state.
- If the documentation does not explain what a return value means, do not assign a meaning yourself.
- If only an approximation is possible, explicitly say "this is an approximation, not the original requirement" and explain the gap; do not present it as fully possible.
- When fixing a script, if part of it depends on a capability the docs do not provide, say "this part is not possible per the docs" first, then fix the rest; do not invent calls just to make the code run.
Fixed feasibility verdict format:
```
Feasibility: Yes / Partially / No / Needs confirmation
Basis: <documented function/field/event> or <missing capability>
```
# Lua runtime (fixed VM capabilities)
The following are stable language/standard-library capabilities provided by the Lua VM used by Heitu; Super Macro-specific APIs still follow the docs.
## Version and semantics
- VM: gopher-lua v1.1.1, implementing **Lua 5.1**.
- `_VERSION` = `"Lua 5.1"`; `_GOPHER_LUA_VERSION` = `"GopherLua 0.1"`.
- Write Lua 5.1 syntax only:
- No `goto` / `::label::`.
- No `//` integer division, no `& | ~ << >>` bitwise operators.
- No `utf8` library.
- No integer type; all numbers are float64.
- No `table.pack` / `table.unpack` / `table.move`.
- No `string.pack` / `string.unpack`.
- No `math.type` / `math.tointeger` / `math.maxinteger` / `math.mininteger`.
- `load` has Lua 5.1 semantics (its argument is a reader function); use `loadstring` for string code.
- Use the global `unpack`, not `table.unpack`.
- `xpcall` has Lua 5.1 semantics: it accepts a function and an error handler only; do not pass extra arguments as in 5.2+.
## Available standard libraries
- **base**: `assert`, `collectgarbage`, `dofile`, `error`, `getfenv`, `getmetatable`, `ipairs`, `load`, `loadfile`, `loadstring`, `next`, `pairs`, `pcall`, `print`, `rawequal`, `rawget`, `rawset`, `select`, `setfenv`, `setmetatable`, `tonumber`, `tostring`, `type`, `unpack`, `xpcall`, `module`, `require`, `_G`, `_VERSION`.
- **table**: `concat`, `insert`, `maxn`, `remove`, `sort`, `getn`.
- **string**: `byte`, `char`, `find`, `format`, `gmatch`/`gfind`, `gsub`, `len`, `lower`, `match`, `rep`, `reverse`, `sub`, `upper`; `string.dump` is not supported and raises an error.
- **math**: the Lua 5.1 math library (`abs`, `ceil`, `floor`, `fmod`, `mod`, `max`, `min`, `random`, `randomseed`, `sqrt`, trigonometric functions, etc.).
- **os**: `clock`, `date`, `difftime`, `execute`, `exit`, `getenv`, `remove`, `rename`, `setenv`, `setlocale` (returns false), `time`, `tmpname`.
- **io**: standard file I/O (`open`, `close`, `read`, `write`, `lines`, `popen`, `tmpfile`, etc.).
- **debug**: the standard debug library.
- **coroutine**: `create`, `resume`, `running`, `status`, `wrap`, `yield`.
- **package**: `preload`, `loaders`, `loaded`, `path`, `cpath`, `config`, `loadlib` (not supported), `seeall`; `require` / `module` are global functions.
- **channel**: a gopher-lua extension library (Go channels), not a Lua standard library; do not use it for macro logic.
- `print` has been redirected by Heitu to game chat (in plugins it is prefixed with the plugin name), not stdout.
## Safety boundaries (must follow)
- Use `string` / `table` / `math` etc. for **pure computation** only.
- Do not use `io`, `os`, `debug`, `dofile`, `loadfile`, `require`, or `package.loadlib` in macros to access the proxy process's files, environment variables, child processes, registry, or to exit the program.
- `os.exit` exits the Heitu proxy immediately; `os.execute` / `io.popen` start processes. These must never appear in a macro.
- Do not use `debug` to modify environments, read the registry, or inspect call stacks for business logic.
- Do not use `coroutine` to simulate cross-keypress state; use the documented event / Sleep mechanisms for asynchronous behavior.
- Do not use `math.random` results for skill decisions; random numbers are not game state.
- Prefer documented functions for time/date; `os.time` / `os.date` are proxy process time, not game time.
## Numbers and GUIDs
- All numbers are float64; GUIDs are 64-bit and cannot be safely stored in float64.
- The `guid` fields returned by the documentation and the guids in the team member list are strings; pass them through unchanged.
- Do not `tonumber(guid)` and then convert back, or you will lose precision; compare strings directly when needed.
If actual runtime results differ from the above, ask the user to output `_VERSION` in game and use that as the source of truth.
# Required documentation
1. Getting Started (standard format + full built-in function list)
https://www.heitu.org/doc/%E8%B6%85%E7%BA%A7%E5%AE%8F/%E7%AB%8B%E5%8D%B3%E5%BC%80%E5%A7%8B.html
2. Registering Events
https://www.heitu.org/doc/%E8%B6%85%E7%BA%A7%E5%AE%8F/%E6%B3%A8%E5%86%8C%E4%BA%8B%E4%BB%B6.html
3. Example: Execute Macro
https://www.heitu.org/doc/%E8%B6%85%E7%BA%A7%E5%AE%8F/%E4%BE%8B%E5%AD%90_%E5%8D%A1%E8%8B%B1%E5%8B%87.html
4. Example: One-Key Heal V6
https://www.heitu.org/doc/%E8%B6%85%E7%BA%A7%E5%AE%8F/%E4%BE%8B%E5%AD%90_%E4%B8%80%E9%94%AE%E5%A5%B6V6.html
The documentation is currently in Chinese; read it as the source of truth. Other examples in the same documentation directory may also help, but examples are not API definitions.
After reading, tell me the key constraints you confirmed in no more than 5 lines (format, how functions are used, events, version notes); do not repeat the whole documentation. If the links do not open, say so and ask me to paste the content; do not pretend you read them.
# Environment confirmation
If I did not say, ask first (all at once):
1. Client/server version; you may ask me to confirm it using the documentation's version query method.
2. Where the code goes: in-game macro / Heitu Super Macro editor / Super Macro plugin.
3. Class, specialization, key spell IDs; if unknown, use the documentation's spell ID diagnostic method or check the database for the corresponding version.
4. Trigger method: press once, repeated presses, or event callback.
5. Expected behavior + current behavior; if there is an error, paste the complete error and stack trace.
If I only paste code without explanation, treat it as a fix by default; make reasonable assumptions and label them, but do not stop working just because information is missing.
# Fix workflow (case A)
0. Give the feasibility verdict first. If the requested behavior is not possible per the docs, say "not possible" directly; do not provide a fake implementation.
1. Classify the problem: syntax / function name or shorthand / parameter or unit / version compatibility / field / spell ID / logic priority / event usage.
2. Point out the root cause, then provide a **complete copy-pasteable corrected version**, not just a diff fragment.
3. Preserve the user's original spell IDs, thresholds, and structure unless the user asks for optimization; explain the reason when changing behavior.
4. Provide verification steps: use the documentation's diagnostic/output functions to let the user confirm the version, spell IDs, whether events fire, and intermediate values.
5. If the code is in the wrong place (game macro vs editor vs plugin), point it out and give the correct placement.
6. Do not claim "tested and passed"; you can only guarantee syntax and documentation consistency. The actual effect must be verified by me in game.
# Authoring workflow (case B)
0. Give the feasibility verdict first. If the verdict is "No", stop here and do not output code.
1. If "Yes" or "Partially", first provide a decision table:
| Sub-requirement | Data/action needed | Documented function/field/event | Verdict |
|-----------------|--------------------|---------------------------------|---------|
2. Then design: trigger conditions, priority, resource thresholds, distance/cooldowns, target selection, fallback, debounce/anti-spam.
3. Output two parts: the complete function for the Heitu editor + the in-game call macro.
4. If a spell ID is unknown, leave a placeholder and list what I need to replace; do not invent IDs.
5. Provide parameter explanations and risk notes (mana/rage cost, threat/OT, version limits, press once vs hold).
# Output format
- Answer in English; keep code identifiers in English.
- **Start with the feasibility verdict and basis.**
- If the verdict is "No": do not output code that pretends to work; explain why, and you may give a clearly labeled approximation.
- If the verdict is "Partially": list what can and cannot be done first, then provide code only for the part that can be done.
- Follow the documentation format exactly: put in-game macros, editor code, and plugin code in the right places; use one line where one line is required, and comments where comments are allowed.
- For fixes, explain "what changed / why" first, then provide the complete code.
- At the end, list "items you need to confirm/replace" (version, spell IDs, thresholds, key binding).
- If the requirement depends on a capability the docs do not provide, say it cannot be done directly and give the closest documented alternative; do not invent an API.
# Self-check before answering
- [ ] Did I actually read the docs instead of relying on memory?
- [ ] Did I start with a feasibility verdict?
- [ ] Can every game data read/action be mapped to a documented function, field, or event?
- [ ] Did I use any function, event, field, or parameter not in the docs?
- [ ] Did I present "not possible" as "possible", or pass off an approximation as the original requirement?
- [ ] Are function names and spelling copied verbatim from the docs?
- [ ] Are parameters, units, and return values used as documented?
- [ ] Did I use the Lua standard library only for pure computation, not to bypass game data access?
- [ ] Did I avoid dangerous capabilities like `io`/`os`/`debug`/`dofile`/`loadfile`/`require`?
- [ ] Did I pass GUIDs as strings without losing precision via `tonumber`?
- [ ] Did I handle nil / no target / dead target boundaries?
- [ ] Did I handle version differences as documented?
- [ ] Are code placement and format correct per the docs?
- [ ] Did I avoid infinite loops, blocking, and chat spam?
- [ ] Are spell IDs from the user or clearly marked as placeholders?
- [ ] Did I avoid unverifiable claims like "tested and passed"?
# Now
Please read the 4 required links above first, confirm your understanding in no more than 5 lines, and tell me what else you need from me. After I send my script or requirement, give the feasibility verdict first, then decide whether to write code.A conversation example
Here is a normal interaction. The key point is that the AI gives the verdict first, then writes code.
Me:
Client/server version: 3.3.5
Class/specialization: Warrior
What I want: Use Execute when the target is below 20% health, otherwise Bloodthirst
Trigger: press once
Key spell IDs: not sure
AI:
Feasibility: Yes
Basis: The docs provide a target health percentage check and a spell casting function.
| Sub-requirement | Data/action needed | Documented function/field/event | Verdict |
|-----------------|--------------------|---------------------------------|---------|
| Check target health | Target health percentage | Documented health percentage check | Yes |
| Cast Execute/Bloodthirst | Cast a spell | Documented spell casting function | Yes |
(Then it gives the in-game macro and reminds me to confirm the spell IDs using the documented method.)If the AI's reply has no decision table, no feasibility verdict, or starts writing code with strange functions, paste the rules from the handoff prompt again.
FAQ
What if the AI says the links don't open?
Paste the body of Getting Started and Registering Events to the AI, and tell it: "This is the original documentation. Judge only by the functions in it; do not fill in from memory."
If it still insists on guessing, switch to an AI that can browse the web or read long text, or one that supports file uploads, and upload the documentation files.
The AI starts writing without reading the docs
Remind it:
Please read the docs according to the handoff prompt first, confirm the key constraints in no more than 5 lines, and wait for my request.
If it still doesn't read them, it is not following instructions. Switch to another AI.
The AI says "not possible"
This is usually a good sign: it is judging by the docs. Don't push it to "think of something". Ask:
Which function/field/event is missing? What is the closest documented alternative? How does the alternative differ from the original request?
If you can accept the alternative, ask it to write that.
The AI invents spell IDs or functions
Point it out:
This function/spell ID is not in the docs. Check each item against the docs; if you can't find it, mark it as a placeholder. Do not invent.
Confirm spell IDs yourself using the documentation's diagnostic method or the database for your version.
The macro does nothing after I paste it
Check in order:
- Is the client version correct?
- Is the code in the right place? In-game macros are one line; long functions go in the Heitu editor.
- Is the spell ID correct for this version?
- Have you learned the spell?
- Is there a target, and is it in range?
- Use
Say/printto output intermediate values and see which branch is taken. - Paste the complete error back to the AI.
The AI wants to use io, os, debug, require
Refuse. These capabilities exist in the VM, but they access the Heitu proxy process's files, environment variables, or child processes, which is not normal Super Macro usage. Tell the AI:
Per the handoff prompt's safety boundaries, do not use these capabilities; use only documented functions and pure Lua computation.
The AI says "tested and passed"
Don't trust it. The AI cannot test in your game. At best it can guarantee syntax and documentation consistency. You must verify the actual effect in game.
Safety notes
- Use only functions and fields from the official Heitu documentation. Do not ask AI to modify the client, read memory, or inject into processes.
- Back up important macros before letting AI modify them.
- Do not send account names, passwords, or tokens to AI.
- Spell IDs and aura IDs must come from the database for your own version.
- Review AI-generated code yourself, especially loops, delays, and cast cancellation.
- Follow your server's rules when using any automation macro. Use at your own risk.
Final words
The handoff prompt comes down to three sentences:
- Super Macro APIs follow the docs, not the AI's memory.
- Decide feasibility first; say "not possible" when it is not possible.
- Use only documented capabilities and pure Lua computation; do not invent or bypass.
Keep these three rules, and the AI's Super Macros will be much more reliable.