# Events

The **TotalControl** library raises events to inform your script about errors, chat messages, IMs, and other activities.

To catch these events, use the LSL `link_message` event (see [TotalControl Examples](/doc/62829c23-2c56-4cff-9882-56f1124de91a) for usage patterns).

## Parsing Events

The `link_message` event in LSL has the following syntax:

```csharp
link_message(integer sender_num, integer num, string str, key id) { ... }
```

For **TotalControl**, the `num` parameter contains the event code (see below).  
The values of `str` and `id` depend on the event type.

## Events List

| **Command** | **Description** |
|---------|-------------|
| **Status** |             |
| [BOT_SETUP_SUCCESS](/doc/d482a906-a622-4f03-8f59-4638d4859b6c) | Raised when Bot has been set successfully. |
| [BOT_SETUP_FAILED](/doc/a73e2dda-c4e5-47b7-bff5-6fe28b7a9e09) | Raised when there was an error setting the bot. |
| [BOT_COMMAND_FAILED](/doc/845c20e0-6816-49fc-9d3e-ce8f552f79ac) | Raised when a command error occurs. |
| [BOT_EVENT_STATUS_REPLY](/doc/1411c9ca-352e-4696-a01c-3ad4664accf4) | Raised when bot status is received. |
| **Listeners** |             |
| [BOT_EVENT_LISTEN_SUCCESS](/doc/994aec1c-cba2-4773-8eb9-4a3de6e53443) | Raised when a listener has successfully been established. |
| [BOT_EVENT_LISTEN_LOCAL_CHAT](/doc/a72df24c-f86a-4722-9b25-0187a63d27c3) | Raised when Bot sees a message in local chat. |
| [BOT_EVENT_LISTEN_IM](/doc/023cd39c-042d-42a0-9380-cdec0a8a5486) | Raised when Bot receives an instant message. |
| [BOT_EVENT_LISTEN_INVENTORY](/doc/55f1a12f-9044-4135-bd56-2bfdc0c1da88) | Raised when Bot receives an inventory item. |
| [BOT_EVENT_LISTEN_MONEY](/doc/bb270626-bf3b-4deb-8926-b0a516ef8e7c) | Raised when Bot receives a payment. |
| [BOT_EVENT_LISTEN_DIALOG](/doc/e0495a6f-7f09-4fcf-acd9-a7bc4ef73676) | Raised when Bot receives a dialog menu. |
| **Request Responses** |             |
| [BOT_LIST_GROUPS_REPLY](/doc/2ea95a9d-af14-4cfc-b7ff-92d66df9dc45) | Raised when Bot receives list of groups. |
| [BOT_LIST_GROUP_ROLES_REPLY](/doc/0fbaf3f0-a43e-4c13-9539-57707d18951f) | Raised when Bot receives list of roles for a group. |
| [BOT_GET_BALANCE_REPLY](/doc/4a2749d1-7b5a-48fa-8499-2a50ef0a6ac3) | Raised when balance is successfully requested. |
| [BOT_ATTACHMENTS_REPLY](/doc/920126a7-b8d4-4ee8-8b4b-28b67a772444) | Raised when Bot receives list of attachments. |
| [BOT_LOCATION_REPLY](/doc/c973534f-9ff1-423a-a50b-37036392a982) | Raised when bot returns its location. |
| [BOT_NOTECARD_CREATE_REPLY](/doc/788c081f-6e16-495f-a749-9e77915bbae7) | Raised when balance is successfully requested. |
| [BOT_NOTECARD_READ_REPLY](/doc/aaa20f97-358e-4d88-80a8-d60b2d8d07d7) | Raised when balance is successfully requested. |

---

**Documents**

- [BOT_EVENT_LISTEN_MONEY](https://www.mysmartbots.com/docs/s/dev/doc/bot_event_listen_money-1OiSreyOQR)
- [BOT_EVENT_LISTEN_SUCCESS](https://www.mysmartbots.com/docs/s/dev/doc/bot_event_listen_success-41qrY04Kne)
- [BOT_EVENT_STATUS_REPLY](https://www.mysmartbots.com/docs/s/dev/doc/bot_event_status_reply-fZOfK5awWH)
- [BOT_ATTACHMENTS_REPLY](https://www.mysmartbots.com/docs/s/dev/doc/bot_attachments_reply-mej5njWJde)
- [BOT_COMMAND_FAILED](https://www.mysmartbots.com/docs/s/dev/doc/bot_command_failed-1VkXmkJUMo)
- [BOT_EVENT_LISTEN_DIALOG](https://www.mysmartbots.com/docs/s/dev/doc/bot_event_listen_dialog-OrhfS072dx)
- [BOT_EVENT_LISTEN_INVENTORY](https://www.mysmartbots.com/docs/s/dev/doc/bot_event_listen_inventory-l3ywtPm72r)
- [BOT_EVENT_LISTEN_LOCAL_CHAT](https://www.mysmartbots.com/docs/s/dev/doc/bot_event_listen_local_chat-V2T87FSebN)
- [BOT_GET_BALANCE_REPLY](https://www.mysmartbots.com/docs/s/dev/doc/bot_get_balance_reply-bYPbFUcrpO)
- [BOT_LIST_GROUP_ROLES_REPLY](https://www.mysmartbots.com/docs/s/dev/doc/bot_list_group_roles_reply-IbUfKecLYe)
- [BOT_LIST_GROUPS_REPLY](https://www.mysmartbots.com/docs/s/dev/doc/bot_list_groups_reply-baggzrSX6p)
- [BOT_NOTECARD_CREATE_REPLY](https://www.mysmartbots.com/docs/s/dev/doc/bot_notecard_create_reply-TedXEwFqyy)
- [BOT_NOTECARD_READ_REPLY](https://www.mysmartbots.com/docs/s/dev/doc/bot_notecard_read_reply-9Cmw6dyva4)
- [BOT_EVENT_LISTEN_IM](https://www.mysmartbots.com/docs/s/dev/doc/bot_event_listen_im-mC90cew0xz)
- [BOT_SETUP_FAILED](https://www.mysmartbots.com/docs/s/dev/doc/bot_setup_failed-hylFsOqrfB)
- [BOT_SETUP_SUCCESS](https://www.mysmartbots.com/docs/s/dev/doc/bot_setup_success-NkbRmNZVIH)
- [BOT_LOCATION_REPLY](https://www.mysmartbots.com/docs/s/dev/doc/bot_location_reply-mYntgDTVMK)