> For the complete documentation index, see [llms.txt](https://code-after-sex.gitbook.io/script-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://code-after-sex.gitbook.io/script-documentation/cas-chat-v2/configuration.md).

# Configuration

Configure CAS Chat V2 for RedM — framework, server name, message length, channel ranges, /try chance, overhead bubbles, the job channel, moderation defaults and flood protection.

Everything is in `config.lua`. The file is loaded on both the server and the client. Run `restart rsm_rpchat` after editing it.

## General

```lua
Config.Framework = 'auto'
```

`auto` looks for `vorp_core` first, then `rsg-core`, and falls back to standalone. Set it to `vorp`, `rsg` or `standalone` to force one.

```lua
Config.ServerName = 'CAS Roleplay'
```

Shown in the chat header and in the welcome line.

```lua
Config.MaxLength = 256
```

Maximum characters per message. This counts characters, not bytes, so accented and non Latin letters each count as one.

```lua
Config.OpenKey = 0x9720FCEE
Config.OpenCommand = 'rpchat'
```

`0x9720FCEE` is `INPUT_MP_TEXT_CHAT_ALL`, the T key. The command works from the F8 console as well.

```lua
Config.RegisterCommands = true
```

Registers `/me`, `/do`, `/ooc` and the rest on the server so they also work from the F8 console and from other resources calling `ExecuteCommand`. Set it to `false` if another resource already owns those command names.

```lua
Config.ConsoleLog = true
```

Writes every message to the server console. Useful for moderation, but it fills up your logs on a busy server.

```lua
Config.RosterRefresh = 30
```

How often, in seconds, the player list refreshes ping, job and session time.

```lua
Config.JoinHistory = 25
```

How many recent public messages a joining player sees. This covers global OOC and announcements only.

```lua
Config.Welcome = 'Welcome to {server}, {name}. Type /help for commands.'
```

Shown once in the System tab when a player connects. `{server}` and `{name}` are replaced. Leave it empty to show nothing.

## Ranges

```lua
Config.Ranges = {
    say = 0,
    me = 15.0,
    ['do'] = 15.0,
    try = 15.0,
    whisper = 2.5,
    shout = 40.0,
    looc = 20.0,
}
```

Distance in metres. The server works out who is in range, so the check cannot be bypassed by a client.

**Set a range to 0 and that channel has no distance limit.** The message reaches everyone in the same world, and the distance calculation is skipped entirely.

Players in a separate world, meaning a different routing bucket such as character creation, a duel arena or an event instance, only talk among themselves. Global OOC is the exception, it ignores routing buckets and always reaches everyone.

```lua
Config.TryChance = 50
```

Success chance for `/try` as a percentage. The roll happens on the server.

## Overhead bubbles

```lua
Config.Overhead = {
    enabled = true,
    kinds = { me = true, ['do'] = true, try = true, say = false, whisper = false, shout = false },
    duration = 7000,
    maxPerPlayer = 3,
    drawDistance = 20.0,
    lineOfSight = true,
    headOffset = 0.32,
}
```

| Key            | Meaning                                            |
| -------------- | -------------------------------------------------- |
| `enabled`      | Turn all bubbles off                               |
| `kinds`        | Which message types open a bubble                  |
| `duration`     | How long a bubble stays, in milliseconds           |
| `maxPerPlayer` | Most bubbles stacked over one character at once    |
| `drawDistance` | Bubbles further than this are not drawn, in metres |
| `lineOfSight`  | Hide a bubble when a wall is in the way            |
| `headOffset`   | Height above the head bone, in metres              |

## Job channel

```lua
Config.NoJob = { unemployed = true, none = true, [''] = true }
```

Job names counted as unemployed. A player with one of these has no job channel. These have to match the job names your framework actually uses.

```lua
Config.JobRequiresDuty = false
```

When true, only players on duty can use the job channel. RSG reports duty state, VORP does not.

```lua
Config.JobIcons = {
    sheriff = 'blip_ambient_sheriff',
    doctor = 'blip_shop_doctor',
    default = 'blip_job',
}
```

Job name to badge icon. Anything not listed uses `default`.

Available icon names: `blip_ambient_law`, `blip_ambient_sheriff`, `blip_ambient_telegraph`, `blip_job`, `blip_player`, `blip_post_office`, `blip_saloon`, `blip_scm_letter`, `blip_shop_doctor`, `blip_shop_honor`, `blip_time_of_day`, `blip_wanted_poster`.

## Moderation defaults

```lua
Config.DefaultSlowMode = 0
Config.DefaultOocLocked = false
```

Starting values for OOC slow mode in seconds and the OOC lock. Staff can change both in game and the change is kept after a restart.

```lua
Config.MuteReasons = { 'Spam', 'Metagaming in OOC', 'Harassment' }
Config.MuteDurations = { 5, 15, 30, 60, 360, 1440, 0 }
```

Presets shown in the mute dialog. Durations are minutes, 0 means permanent.

```lua
Config.Flood = { window = 6, max = 5 }
```

Flood protection. At most `max` messages per `window` seconds. Staff are exempt.

## Text

`Config.Text` holds every message the server sends to a player. Translate it into your own language if you want. The `%s` and `%d` markers have to stay in place and in the same order.

## Staff

Covered separately in [Staff permissions](/script-documentation/cas-chat-v2/permissions.md).
