> 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/event-logs/players/population.md).

# Population

Sends periodic server population statistics to Discord

The Population feature sends periodic snapshots of your server's online player count to Discord. This helps your community see how active the server is at a glance.

## Action

`population`

## When It's Used

This log is sent:

* **Periodically** at a configurable interval (minimum 60 seconds)
* **Automatically** without any player action
* Contains a breakdown of player types

## Why Use It

* **Show server activity** to your Discord community
* **Track population trends** over time
* **Attract new players** by showing an active server
* **Monitor peak hours** for events and maintenance
* **Distinguish active vs AFK** player counts

## Server Configuration

In `conf/channels.conf`:

```
// Population statistics logging
ragnasync_population_log_enabled: true
ragnasync_population_log_channel_id: "YOUR_CHANNEL_ID"
ragnasync_population_log_interval: 1800
```

| Setting                               | Description                             | Default         |
| ------------------------------------- | --------------------------------------- | --------------- |
| `ragnasync_population_log_enabled`    | Enable/disable population logging       | `false`         |
| `ragnasync_population_log_channel_id` | Discord channel ID for population stats | -               |
| `ragnasync_population_log_interval`   | Seconds between updates (minimum 60)    | `3600` (1 hour) |

## Message Format

The default message shows a complete player breakdown:

```
👥 Population:    | Total: 150   | Active: 95   | Vending: 30   | Autotrade: 20   | Buyingstore: 3
```

## Data Fields

| Field         | Type   | Description                                        |
| ------------- | ------ | -------------------------------------------------- |
| `total`       | int    | Total online players (all types combined)          |
| `active`      | int    | Players actively playing (not vending/autotrading) |
| `vending`     | int    | Players with manual vending shops open             |
| `autotrade`   | int    | Players in autotrade mode (AFK vending/buying)     |
| `buyingstore` | int    | Players with manual buying stores open             |
| `channel`     | string | Discord channel ID                                 |

## Player Categories Explained

| Category        | Description                       |
| --------------- | --------------------------------- |
| **Total**       | Everyone logged in                |
| **Active**      | Playing the game, not in a shop   |
| **Vending**     | Running a player shop (manually)  |
| **Autotrade**   | AFK with @autotrade active        |
| **Buyingstore** | Running a buying store (manually) |

## Example Use Cases

### Server Status Channel

Create a dedicated channel for population updates:

```
ragnasync_population_log_channel_id: "1234567890"  // #server-status
ragnasync_population_log_interval: 1800            // Every 30 minutes
```

### Peak Hour Tracking

Use shorter intervals during events to track participation:

```
ragnasync_population_log_interval: 300  // Every 5 minutes during events
```

### Recruitment

Show prospective players that your server is active with regular updates.

## Custom Messages

Want to customize how these messages look? Head to the **Message Routes** page on your dashboard, set the format to **Custom Message**, and compose your own template using `{{placeholder}}` syntax.

**Example template:**

```
:globe_with_meridians: Online: {{total}} players ({{active}} active, {{vending}} vending)
```

**Available placeholders for this event:**

| Placeholder       | Example |
| ----------------- | ------- |
| `{{total}}`       | 150     |
| `{{active}}`      | 95      |
| `{{vending}}`     | 30      |
| `{{autotrade}}`   | 20      |
| `{{buyingstore}}` | 3       |

See [Message Routing](/ragnascript/message-routing.md) for more about formats, conditions, and multi-channel routing.

## Interval Recommendations

| Interval          | Use Case                                |
| ----------------- | --------------------------------------- |
| 60-300s           | During events, high activity monitoring |
| 1800s (30 min)    | Active community updates                |
| 3600s (1 hour)    | Standard server status                  |
| 86400s (24 hours) | Daily summary                           |

## Notes

* Minimum interval is 60 seconds to prevent spam
* Population counts are calculated server-side at the time of sending
* Great for integration with Discord bot status displays
* Consider using with a dedicated "server-status" channel
