# Terminal

{% hint style="info" %}
Included commands are for demonstration purposes only.
{% endhint %}

> Designed to mimic the look and feel of a traditional terminal, this app provides an intuitive and powerful tool for executing various commands.

<figure><img src="/files/GtBh67OGxfLY5qRItzsc" alt=""><figcaption></figcaption></figure>

#### Register Commands

* Navigate to `av_laptop/server/editable/_terminal.lua`
* Add your custom commands to the `allCommands` table using the following structure:

#### Base Properties

* **index key**:`string` The command trigger. This must be unique.
* **show**:`boolean` Displays the command when command help is used.
* **args?**:`string` Defines the required parameters for the command. All parameters are combined into a single string, with each one enclosed in angle brackets (`< >`)&#x20;

  ```lua
  args = "<Input 1> <Input 2> <Input 3>"
  ```
* **allowed**: `function(playerId, laptopSerial)` Returns `true` or `false`. Determines if the player is permitted to see and use the command. If `false`, the command will be hidden from the `/help` list.
* **canProcess**: `function(playerId, laptopSerial, args)` Verifies that the user meets the requirements to execute the command (e.g., special permissions, specific items, or required arguments).
* **onSuccess:** `function(playerId, laptopSerial, args)` This function runs only if `canProcess` returns `true`. Use this to execute any custom server-side logic.
* **actions:**`table[]` A sequence of actions executed by the terminal in descending order. Each action supports the following properties:

#### Action Properties

* **type:**`string` The action to perform.&#x20;
  * Available options: `"text"`, `"progressbar"`, `"minigame"` `"external"` `"userInput"` `"table"`&#x20;
* **input?:**`string` The content to be processed (e.g., the text to display or the name of the minigame to trigger). List of available minigames can be found in the Minigames section.
* **delay:**`number` The duration (in milliseconds) to wait before executing the next action in the sequence.
* **style:**`string` *Optional.* Used with the `"text"` type to apply an `"error"` or `"output"` visual style.
* **callback?**:`string` Callback to trigger after action gets completed, this callback should be already registered client side, you can find an example here: [Exports](/laptop-pack-v3/laptop-v3/terminal/exports.md)
* **output:**`table[]` The final message rendered once all actions and minigames have been successfully completed.
  * **message (string):** The text content to display.
  * **color (string):** The HEX or CSS color for the text.

```lua
['jailbreak'] = { -- command used, should be unique and also a string
        show = true,
        args = "<Input 1> <Input 2> <Input 3>",
        allowed = function(playerId, laptopSerial)
            return true
        end,
        canProcess = function(playerId, laptopSerial, args)
            return true
        end,
        onSuccess = function(playerId, laptopSerial, args)
            print("onSuccess()")
        end,
        actions = {
            {type = "text", input = "Accessing local kernel bootloader...", delay = 600},
            {type = "progressbar", input = "Corrupting security signed-boot", delay = 4000},
            {type = "text", input = "Warning: Integrity check bypassed. System unstable.", style = "error", delay = 1000},
            {type = "progressbar", input = "Mounting read-write partition", delay = 3500},
            {type = "text", input = "Injecting unsigned binary signature...", delay = 500},
            {type = "minigame", input = "grid", label = "KERNEL_VULN_MAPPER"}
        },
        output = {
            message = ">>> SYSTEM JAILBROKEN: RESTRICTIONS REMOVED. THIRD-PARTY APPS ENABLED.",
            color = "teal"
        }
    },
```

#### Table

The `table` action renders a structured data grid directly within the terminal output. It is highly useful for displaying organized lists, such as nearby networks, vehicle data, or directory contents.

Properties:

* `type` (string): Must be exactly `"table"`.
* `columns` (array): An array of strings defining the header titles.
* `rows` (array): A multi-dimensional array containing the row data. The data order must match the defined columns.
* `delay` (number): The pause duration in milliseconds after rendering the table before executing the next action.

*You can find a demo script using Tables in* [Exports](/laptop-pack-v3/laptop-v3/terminal/exports.md#keyfob-example)

```lua
local data = {}

table.insert(data, {
    "ABC123",
    "Asea",
    "avscripts",
    string.format("%.1fm", 2.0)
})

local actionConfig = {
    type = "table",
    columns = {"PLATE", "MODEL", "SSID", "DISTANCE"},
    rows = data,
    delay = 0
}
```


---

# Agent Instructions: 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:

```
GET https://docs.av-scripts.com/laptop-pack-v3/laptop-v3/terminal.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
