> 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-staff-chat/using-the-chat.md).

# Using the Chat

Use CAS Staff Chat in game: open it with /staffchat, send messages, read unread alerts, switch alerts on or off and clear the history.

## Opening and closing

* Type `/staffchat` to open the chat. If `CAS.EnableCommand` is `false`, press the key set in `CAS.keyHash` instead (**J** by default).
* Press **Esc**, or the close button, to close it.

The window shows the whole history, oldest at the top, and scrolls to the newest message. Your own messages sit on one side and other admins' messages on the other, each with an avatar, a name and the time it was sent.

## Sending a message

Type in the box at the bottom and press **Enter**, or click the send icon. The message goes to every admin who is online, with a short send sound.

## New message alerts

While your chat is closed, each new message:

* plays a sound,
* shows a round badge with the number of unread messages for a few seconds.

When you open the chat, the counter resets.

`/togglebox` switches these alerts on or off for you. Alerts are switched off each time you join the server, so run `/togglebox` once to turn them on.

## Clearing the history

`/clearchat` empties the chat for every admin online. Only admins with `canClearChatHistory = true` can use it. Other players get "You don't have enough permission for clear chat."

## Where messages are kept

Every message is saved to `messageData.json` in the resource folder and loaded again when the server starts. A cleared history is written to the file with the next message, or when the resource stops.
