# 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://outline-production-attachments.s3-accelerate.amazonaws.com/uploads/fe746996-bd68-4ba8-a15e-e239ddd741be/727d7bd0-6a2c-4354-be60-7fdafb252689/Totalcontrol-scheme.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIA4EOUDTOVUICLPZ4P%2F20260919%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20260919T064500Z&X-Amz-Expires=86400&X-Amz-Signature=7c6c51fc8500e078282241bb2a69bbce26c7ec5c5251bc42c1aa8abac2b86a85&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/commands-JTCRnw6BK2) section contains the full list of the commands.  
[TotalControl Events](/doc/events-nCWtBhiIc1) 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/commands-JTCRnw6BK2)
* Receive [events](/doc/events-nCWtBhiIc1)


---

## Examples

We've provided examples on the most important functions of TotalControl - available [here](/doc/examples-hXsET8az4A).

---

**Documents**

- [Initialising TotalControl](https://sb-docs-dev.getoutline.com/s/dev/doc/initialising-totalcontrol-B33eIBsvSR)
- [Status codes](https://sb-docs-dev.getoutline.com/s/dev/doc/status-codes-9d5c3yremD)