> ## Documentation Index
> Fetch the complete documentation index at: https://docs.erlc.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Running In-Game ERLC Commands from erlc.dev Studio

> Execute ERLC in-game commands, respond to custom player commands, and use API-key-authenticated command execution from erlc.dev Studio automations.

erlc.dev Studio gives you several blocks for sending commands directly into your ERLC server, listening for players who type custom in-game commands, and logging output to the Studio panel — all without writing a single line of code.

<Note>
  ERLC commands are executed in the context of your linked server. Make sure your server's API key is connected and that your bot has the appropriate permissions before using any command block.
</Note>

## Running Commands

Use these blocks to send commands to your ERLC server from inside an automation. Connect a value block to the **COMMAND** input to supply the command string.

<CardGroup cols={2}>
  <Card title="erlc_command" icon="terminal">
    Run any ERLC command. Connect a value block (such as a text or variable block) to the **COMMAND** input. This is the recommended block for most use cases.
  </Card>

  <Card title="erlc_command_legacy" icon="clock-rotate-left">
    A legacy block that accepts a static command string directly in its **COMMAND** field. Use `erlc_command` for new automations — this block exists only for backward compatibility.
  </Card>

  <Card title="erlc_dynamic_command" icon="code">
    Build and send a command from a dynamically constructed string. Connect any value block to the **COMMAND** input, including concatenated text or variable references.
  </Card>

  <Card title="erlc_run_command_with_api_key" icon="key">
    Run a command using a specific API key rather than the default server key. Provide both the **COMMAND** and **API\_KEY** value inputs. Useful when managing multiple servers from one automation.
  </Card>
</CardGroup>

### Block Inputs & Fields

| Block | Inputs | Fields |
| - | - | - |
| `erlc_command` | `COMMAND` (value) | — |
| `erlc_command_legacy` | — | `COMMAND` (text) |
| `erlc_dynamic_command` | `COMMAND` (value) | — |
| `erlc_run_command_with_api_key` | `COMMAND`, `API_KEY` (values) | — |

***

## Custom Game Commands

You can define your own in-game slash commands that players type inside ERLC. When a player uses one of these commands, your automation fires and receives the command data.

<CardGroup cols={2}>
  <Card title="erlc_when_game_command" icon="bolt">
    Trigger an automation when a player types a specific command in-game. Set the **COMMAND** field to the command name (without a leading slash).
  </Card>

  <Card title="erlc_when_event (custom_command)" icon="satellite-dish">
    An alternative event trigger. Use the `erlc_when_event` block and set its **EVENT\_TYPE** to `custom_command` to catch any custom command generically.
  </Card>
</CardGroup>

### Reading Command Data

Once inside a custom command automation, use the `erlc_event_value` block to read details about the command that was called. Set its **FIELD** dropdown to one of the following:

| Field | Description |
| - | - |
| `CommandName` | The name of the command the player typed |
| `CommandArguments` | All arguments passed after the command name |
| `Command` | The full raw command string including arguments |
| `Caller` | The player object for the player who ran the command |

***

## Log Output

These blocks write messages to the Studio log panel, which is useful for debugging your automations.

<CardGroup cols={2}>
  <Card title="erlc_log" icon="list">
    Log a message to the Studio panel. Connect a value block to the **MESSAGE** input.
  </Card>

  <Card title="erlc_dynamic_log" icon="list-check">
    Same as `erlc_log` but designed for dynamically built strings. Connect any value block to the **MESSAGE** input.
  </Card>
</CardGroup>

***

## Example: Custom Command with Arguments

The following automation fires when a player runs the `/announce` custom command in-game, reads the arguments they passed, and sends a server-wide ERLC command using those arguments.

```json theme={null}
{
  "type": "erlc_when_game_command",
  "id": "trigger_1",
  "fields": {
    "COMMAND": "announce"
  },
  "next": {
    "block": {
      "type": "erlc_log",
      "id": "log_1",
      "inputs": {
        "MESSAGE": {
          "block": {
            "type": "erlc_event_value",
            "id": "ev_args",
            "fields": {
              "FIELD": "CommandArguments"
            }
          }
        }
      },
      "next": {
        "block": {
          "type": "erlc_command",
          "id": "cmd_1",
          "inputs": {
            "COMMAND": {
              "block": {
                "type": "erlc_event_value",
                "id": "ev_cmd",
                "fields": {
                  "FIELD": "Command"
                }
              }
            }
          }
        }
      }
    }
  }
}
```

<Tip>
  Use `erlc_dynamic_command` instead of `erlc_command` when you need to concatenate the command string from multiple parts — for example, prepending a prefix to the player-supplied arguments.
</Tip>

### How This Works

<Steps>
  <Step title="Trigger on the custom command">
    The `erlc_when_game_command` block listens for a player typing `/announce` in-game and fires the automation.
  </Step>

  <Step title="Log the arguments">
    The `erlc_log` block reads the `CommandArguments` field via `erlc_event_value` and prints it to the Studio log panel so you can verify the input.
  </Step>

  <Step title="Run the command">
    The `erlc_command` block reads the full `Command` field and sends it to the ERLC server, executing it in the context of your linked server.
  </Step>
</Steps>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.