For the complete documentation index, see llms.txt. This page is also available as Markdown.

Message Templates

Send pre-formatted messages from your game server to Discord using the src_template placeholder

Message templates let your game server send its own pre-formatted messages to Discord. Instead of relying on RagnaSync's built-in formatting, your server controls the exact text that appears.

This is especially useful when your server has information that RagnaSync doesn't know about β€” like map names, party details, or item categories.

How It Works

  1. Your game server adds a [template: ...] field to its RagnaScript packet

  2. RagnaSync captures the template text and makes it available as {{src_template}}

  3. On your dashboard, set a route's format to Custom Message and use {{src_template}} as the template

That's it β€” whatever your server puts in the [template: ...] field shows up in Discord.

Quick Setup

Step 1: Add the Template Field to Your Server

In your game server's source code, append a [template: ...] field to the RagnaScript message:

sprintf(buf, "[action: mob_item_drop][channel: %s][player_name: %s][mob_name: %s]"
    "[mob_id: %d][item_name: %s][item_id: %d][rate: %d]"
    "[account_id: %d][char_id: %d]"
    "[template: :gem: [Card Drop] %s obtained %s's %s at %s.]",
    channel_id, sd->status.name, mob_name,
    mob_id, item_name, item_id, rate,
    sd->status.account_id, sd->status.char_id,
    sd->status.name, mob_name, item_name, map_name);

The template field is optional β€” messages without it work exactly as before.

Step 2: Configure the Route on Your Dashboard

  1. Go to Discord > Message Routes on your RagnaSync dashboard

  2. Find the event type (e.g., Mob Item Drops) and edit the route

  3. Set the format to Custom Message

  4. In the template editor, type: {{src_template}}

  5. Save

Step 3: That's It

Your Discord messages will now show whatever your server puts in the template field:

Supported Script Types

The [template: ...] field works with these script types:

Script Type
Action
Use Case

Mob Item Drop

mob_item_drop

Item drop announcements

Homunculus Item Drop

hom_item_drop

Homunculus kill drops

Mercenary Item Drop

merc_item_drop

Mercenary kill drops

Mob Death

mob_death

Boss/MVP kill announcements

@Command Log

at_command

GM command audit logging

Mixing with Other Placeholders

You can combine {{src_template}} with other placeholders for hybrid messages:

Or use {{src_template}} as just part of a bigger template:

If your server doesn't send a template for a particular message, {{src_template}} resolves to an empty string β€” so your custom message degrades gracefully.

Template Examples

Card Drop Announcements

Server-side (C):

Discord result:

Boss Kill with Party

Server-side (C):

Discord result:

Conditional Templates by Rarity

Server-side (C):

GM Command Audit

Server-side (C):

Dashboard template: {{src_template}}

Discord result:

Using Emojis

You can use Discord emoji shortcodes in your templates β€” RagnaSync automatically converts them to real emoji. This works even inside code blocks where Discord normally wouldn't parse them.

Shortcode
Emoji
Good For

:gem:

πŸ’Ž

Rare drops

:trophy:

πŸ†

Boss kills

:tada:

πŸŽ‰

Celebrations

:star:

⭐

Achievements

:fire:

πŸ”₯

Hot items

:skull:

πŸ’€

Deaths

:crossed_swords:

βš”οΈ

Combat

:warning:

⚠️

Alerts

:small_orange_diamond:

πŸ”Έ

Compact logs

:small_blue_diamond:

πŸ”Ή

Info lines

Tips

  • The [template: ...] field should always be the last field in your RagnaScript packet

  • Templates are optional β€” if you don't include one, the message uses whatever format is set on the dashboard route

  • If a route's format is set to Log, Embed, or Narrate, the {{src_template}} placeholder won't be used β€” switch to Custom Message to use it

  • Emoji shortcodes are case-sensitive: :gem: works, :Gem: doesn't

  • Keep templates under ~2000 characters (Discord's message limit)

Troubleshooting

Template not showing up?

  • Make sure the route is set to Custom Message format on the dashboard

  • Make sure the template field contains {{src_template}}

  • Check that your server is sending the [template: ...] field in the RagnaScript packet

Empty messages?

  • If {{src_template}} is the only thing in your custom template and the server didn't send a template field, the message will be empty. Add a fallback: {{src_template}}{{player_name}} got {{item_name}}

Brackets showing wrong?

  • Player names with brackets like [GM] Player are fine β€” the parser handles this correctly as long as [template: ...] is the last field in the packet

Last updated