> 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/scripts.md).

# Overview

How RagnaScript works and the npc\_message action

RagnaScript is how your Ragnarok server talks to Discord. You add `ragnascript()` calls to your NPC scripts, and RagnaSync turns them into Discord announcements.

## Syntax

```c
ragnascript("[action: npc_message][name: ...][message: ...][channel: ...]");
```

Every call is an `action` plus a set of `[key: value]` fields. For scripts you write yourself, that action is **`npc_message`** — it posts a message to Discord on your server's behalf.

```c
ragnascript("[action: npc_message][name: Event Manager][message: Daily Hunt is now active!][channel: YOUR_CHANNEL_ID]");
```

## Required fields

`npc_message` takes just three fields:

| Field     | Description                                                                                          |
| --------- | ---------------------------------------------------------------------------------------------------- |
| `name`    | The author name shown in Discord — an NPC label like `System` or `Event Manager` (not a real player) |
| `message` | The text that appears in Discord                                                                     |
| `channel` | The Discord channel ID to post to                                                                    |

{% hint style="info" %}
`npc_message` is unattributed — there's no player attached, so it needs no `account_id` or `char_id`. That's what makes it the right action for anything the *server* says.
{% endhint %}

## What about chat, requests and logs?

Other Discord features aren't actions you hand-write — they're turned on in your configuration and run automatically:

* **Player chat** bridging is configured, not scripted — see [Message Sync](/getting-started/channel-messages.md).
* **Player `@request` support messages** are handled for you — see [Ticket Support Command](/features/ticket-system/ticket-support.md).
* **Logging** (mob drops, deaths, vending, refine and more) is enabled in config — see the **Event Logs** section in the sidebar.

## Next steps

* [NPC Examples](/ragnascript/custom-messages.md) — ready-to-use `npc_message` scripts and the mechanics behind them.
* [Build with AI](/ragnascript/build-ragnascripts-with-ai.md) — have Claude or ChatGPT write scripts for you.
