# Run Function

{% code lineNumbers="true" %}

```
run()
```

{% endcode %}

This executes a Minecraft (or any other installed mod) command. The command runs with operator-level (level 4) perms. **DO NOT INCLUDE THE `/` PREFIX!**

Variables used in the `run()`  function are solved automatically to their values, so no quotes or concatenation are needed!

Examples:

{% code lineNumbers="true" %}

```
run(give @p minecraft:diamond 1)
run(time set day)
run(tp @p 0 64 0)
```

{% endcode %}

With variables:

{% code lineNumbers="true" %}

```
var player = "@p"
var amount = 5
run(give player minecraft:diamond amount)
```

{% endcode %}

{% hint style="info" %}
Only declared variables are resolved. Unknown words are passed as-is to the command.
{% endhint %}

#### Mod Compatibility with Run Function

The `run()` function is compatible with any installed mod if the said command or item exists. This makes ControlScript a powerful layer for your entire modpack, not just vanilla Minecraft!

Example:

{% code lineNumbers="true" %}

```
run(give @a tfmg:asphalt_slabs 1)
run(anothermodscommand @p value="Hello")
```

{% endcode %}


---

# 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://control-blocks-mod.gitbook.io/control-blocks-mod-docs/controlscript/built-in-functions/run-function.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.
