> For the complete documentation index, see [llms.txt](https://docs.ragnasync.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ragnasync.com/ragnascript/build-ragnascripts-with-ai.md).

# Build with AI

Use Claude, ChatGPT, or any AI assistant to write npc\_message scripts for you

You don't have to write RagnaScripts by hand. AI assistants like **Claude** and **ChatGPT** are great at turning a plain-English idea ("announce to Discord when an MVP dies") into a working `npc_message` call — as long as they know how RagnaSync works.

This page focuses on `npc_message`, the action your server uses to post its own announcements to Discord (events, WoE status, boss kills, server notices). It gives you two things:

1. A **context prompt** to give the assistant first, so it understands `npc_message` and reads our docs.
2. **Example prompts** to build on.

***

## Step 1 — Give the assistant context

AI assistants don't know about RagnaSync out of the box. Give it this block at the start of your chat. It points the assistant at [docs.ragnasync.com](https://docs.ragnasync.com) so it can look up the real syntax instead of guessing.

{% hint style="info" %}
Claude and ChatGPT can both browse the web, and some setups (like Claude with direct repo access) can read your server files too. Either way, this prompt tells the assistant to read our docs before answering — that's what keeps the scripts accurate.
{% endhint %}

```
You are helping me write npc_message RagnaScripts for RagnaSync, a tool that
bridges a Ragnarok Online server (rAthena/Hercules) to Discord.

Before answering, read the documentation at https://docs.ragnasync.com so you
understand the current syntax and required fields. Focus on the npc_message
action specifically:

- The ragnascript() command and its [key: value] bracket syntax
- The npc_message action, used for server-generated announcements
- Its three fields: name (the author label shown in Discord),
  message (the text, which can include game data, emoji, and Markdown),
  and channel (the Discord channel ID)
- npc_message is unattributed — it takes no account_id or char_id

When I describe what I want, give me a complete NPC script in the
rAthena/Hercules scripting language using npc_message. Use YOUR_CHANNEL_ID as a
placeholder for the Discord channel ID, and keep each ragnascript() call on one
line. If a request would need a different action or a field the docs don't
support, tell me instead of inventing one.
```

Once the assistant confirms it has read the docs, start asking for scripts.

***

## Step 2 — Ask for what you want

With the context loaded, describe your idea in plain English. Be specific about **when** it should fire and **what** the Discord announcement should say.

### Example prompts

> Write an NPC that announces to Discord whenever the MVP "Baphomet" is killed, including which player landed the kill.

> Post a "Server is now online!" announcement to Discord every time the server boots.

> I want a daily countdown. Announce "WoE starts in 1 hour" to Discord at 7pm server time.

> Create a quest NPC. When a player turns in the final item, post an announcement to Discord congratulating them by name.

> Announce the current online player count to Discord every hour.

> When a player donates through my existing donation NPC, post a thank-you announcement to Discord.

### Tips for better results

* **Name the trigger.** "When a player logs in" → `OnPCLoginEvent`. "Every hour" → `OnHour`. The clearer the trigger, the better the script.
* **Say who the message is from.** `npc_message` shows whatever you put in the `name` field as the Discord author — tell the assistant what label to use (e.g. "from Event Manager").
* **Ask it to explain.** Add "explain each line" if you want to learn the syntax as you go.
* **Iterate.** If the first script isn't quite right, just reply with the change ("also broadcast it in-game with announce").

***

## Step 3 — Test before you trust

AI gets you most of the way, but always sanity-check:

1. Add the script to a test NPC on a **test/dev server** first.
2. Reload scripts (`@reloadsync` for RagnaSync config, `@reloadscript` for the NPC) and trigger the event.
3. Confirm the announcement lands in the right Discord channel with the right text.

{% hint style="warning" %}
Double-check the `channel` ID the assistant used. A wrong channel ID is the most common reason a script "works" but nothing shows up in Discord.
{% endhint %}

***

## Want to write them yourself?

If you'd rather understand the syntax directly, start with the [RagnaScript Overview](/ragnascript/scripts.md) and browse the [NPC Examples](/ragnascript/custom-messages.md) for ready-to-use `npc_message` scripts.
