> For the complete documentation index, see [llms.txt](https://sneakyevil.gitbook.io/sleeping-dogs-de-script-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sneakyevil.gitbook.io/sleeping-dogs-de-script-api/classes/console.md).

# Console

### Examples:

#### .AddCommand with any args count:

```squirrel
function ExampleCommand(Args)
{
    print(format("We got %d args.", Args.len()));
}

Console.AddCommand("examplecmd", "This is example description", ExampleCommand);
```

#### .AddCommand with limited args count:

```squirrel
function ExampleCommand(Args)
{
    print(format("First arg: %s", Args[0]));
    print(format("Second arg: %s", Args[1]));
    print(format("Third arg: %s", Args[2]));
}

Console.AddCommand("examplecmd", "This is example description", "<arg0> <arg1> <arg2>", 3, ExampleCommand);
```

#### .Print with multi color:

```squirrel
Console.Print("Red ", Color(255, 0, 0));
Console.Print("Green ", Color(0, 255, 0), true);
Console.Print("Blue", Color(0, 0, 255), true);
```

### Static Functions:

#### .AddCommand

`Console.AddCommand(name: string, description: string, usage: string, numargs: integer, callback: function)`: boolean

| Argument    | Type              | Description                   |
| ----------- | ----------------- | ----------------------------- |
| name        | string            | Name of the command           |
| description | string (optional) | Description of the command    |
| usage       | string (optional) | Usage of the command          |
| numargs     | string (optional) | Number of args required       |
| callback    | function          | Function that will get called |

Returns true when command was successfully registered and doesn't exist.

#### .RemoveCommand

`Console.RemoveCommand(name: string)`

| Argument | Type   | Description         |
| -------- | ------ | ------------------- |
| name     | string | Name of the command |

Removes command by name. Note: You can't remove command registered by other script!

#### .Print

`Console.Print(text: string, color: Color, sameline: boolean)`

| Argument | Type               | Description             |
| -------- | ------------------ | ----------------------- |
| text     | string             | Text to print           |
| color    | Color              | Color object            |
| sameline | boolean (optional) | Will print on last line |

This is mostly same as `print` function, but this will open you more option for like raw text printing & color and printing on old line to make multi color print.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://sneakyevil.gitbook.io/sleeping-dogs-de-script-api/classes/console.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
