# Usage

This section describes how to communicate with the TotalControl script: manage it to login / logout your bot, talk over and listen to bot chat etc.

## Interacting with TotalControl

The two-way communication is performed by using commands and events:

 ![](https://nyc3.digitaloceanspaces.com/smartbots-docs/uploads/20adbcf8-a916-46eb-b77b-ad6944665550/fcd30617-9ba6-4e20-8cf4-cf41fecf82f9/Totalcontrol-scheme.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=DO801JV4MUMY3YAEJCWC%2F20261113%2Fnyc3%2Fs3%2Faws4_request&X-Amz-Date=20261113T140000Z&X-Amz-Expires=86400&X-Amz-Signature=6980ed5fb3f8d924996305339c7f1ca0347d8fa829e7a46cf54051818a43d759&X-Amz-SignedHeaders=host&x-amz-checksum-mode=ENABLED&x-id=GetObject " =428x311")

| **COMMANDS** (your script → bot) | **EVENTS** (bot → your script) |
|------------------------------|----------------------------|
| These are the commands you send to the bot (initialization, group invitation etc). | Events are notifications being sent from the bot to your script (error messages, group chat IMs etc). |

[TotalControl Commands](/doc/b009e014-aa34-4b63-94dc-f128af6b3686) section contains the full list of the commands.  
[TotalControl Events](/doc/8c5e98a8-e014-43fd-a68a-3f4a7b48921f) section contains all events which can be sent by TotalControl to your script.


---

## How to send commands

Use LSL `llMessageLinked` function to send commands to the bot.

```csharp

llMessageLinked(LINK_SET, BOT_GET_BALANCE, "", NULL_KEY);
```


---

## How to receive events

Use `link_message` LSL event to catch the events from the bot.

```csharp

link_message(integer sender, integer cmd, string data, key id) {
  if(cmd == BOT_EVENT_LISTEN_MONEY) {
    debug("My balance is: " + data);
  } 
}
```


---

## Was the command successful?

TotalControl invokes events to send you the command result.


---

## Your script work

* Initialize TotalControl (set bot name): Initializing TotalControl
* Send [commands](/doc/b009e014-aa34-4b63-94dc-f128af6b3686)
* Receive [events](/doc/8c5e98a8-e014-43fd-a68a-3f4a7b48921f)


---

## Examples

We've provided examples on the most important functions of TotalControl - available [here](/doc/62829c23-2c56-4cff-9882-56f1124de91a).

---

**Documents**

- [Initialising TotalControl](https://www.mysmartbots.com/docs/s/dev/doc/initialising-totalcontrol-trsQAqiP1L)
- [Status codes](https://www.mysmartbots.com/docs/s/dev/doc/status-codes-3pmXIQ7hLr)