# Get Function

The `get()` function can be powerful in some cases. It gives you information about specific things in the game that you can later use in your script. There are a few uses and presets for it at the moment.

### <i class="fa-clock">:clock:</i> Time

{% code lineNumbers="true" %}

```
get(time)
```

{% endcode %}

The function returns game time (0-24000). Resets each day.

### <i class="fa-cloud">:cloud:</i> Weather

{% code lineNumbers="true" %}

```
get(weather)
```

{% endcode %}

The function returns `"clear"` , `"rain"` or `"thunder"`.

### <i class="fa-user">:user:</i> Player Count

{% code lineNumbers="true" %}

```
get(players)
```

{% endcode %}

The function returns the number of players who are currently online.

### <i class="fa-heart">:heart:</i> Player Health

{% code lineNumbers="true" %}

```
get(player.health, target)
```

{% endcode %}

The function provides the player's health score, ranging from 0 to 20. The target can either be a player name or an alias like `@p`.

{% code lineNumbers="true" %}

```
-- With Playername
    get(player.health, PlayerName)
    
-- With Alias
    get(player.health, @p)
```

{% endcode %}

### <i class="fa-utensils">:utensils:</i> Player Hunger

{% code lineNumbers="true" %}

```
get(player.food, target)
```

{% endcode %}

The function returns the player's hunger score, ranging from 0 to 20. The target can either be a player name or an alias like `@p`.

{% code lineNumbers="true" %}

```
-- With Playername
    get(player.food, PlayerName)
    
-- With Alias
    get(player.food, @p)
```

{% endcode %}

### <i class="fa-lungs">:lungs:</i> Player Air Supplies

{% code lineNumbers="true" %}

```
get(player.air, target)
```

{% endcode %}

The function returns the player's air supply (when underwater), ranging from 0 to 300. The target can either be a player name or an alias like `@p`.

{% code lineNumbers="true" %}

```
-- With Playername
    get(player.air, PlayerName)
    
-- With Alias
    get(player.air, @p)
```

{% endcode %}

### <i class="fa-flask-round-potion">:flask-round-potion:</i> Player XP Level

{% code lineNumbers="true" %}

```
get(player.level, target)
```

{% endcode %}

The function returns the player's XP level. The target can either be a player name or an alias like `@p`.

{% code lineNumbers="true" %}

```
-- With Playername
    get(player.level, PlayerName)
    
-- With Alias
    get(player.level, @p)
```

{% endcode %}

### <i class="fa-location-pin">:location-pin:</i> Player Coordinates

{% code lineNumbers="true" %}

```
get(player.x/y/z, target)
```

{% endcode %}

The function returns the player's coordinates. The target can either be a player name or an alias like `@p`.

{% code lineNumbers="true" %}

```
-- With Playername
    get(player.x/y/z, PlayerName)
    
-- With Alias
    get(player.x/y/z, @p)
```

{% endcode %}

### <i class="fa-pickaxe">:pickaxe:</i> Player Gamemode

{% code lineNumbers="true" %}

```
get(player.gamemode, target)
```

{% endcode %}

The function returns the player's gamemode. The target can either be a player name or an alias like `@p`.

Returns either `"survival"`, `"creative"`, `"adventure"` or `"spectator"`.

{% code lineNumbers="true" %}

```
-- With Playername
    get(player.gamemode, PlayerName)
    
-- With Alias
    get(player.gamemode, @p)
```

{% endcode %}

### <i class="fa-address-card">:address-card:</i> Player Name

{% code lineNumbers="true" %}

```
get(player.name, target)
```

{% endcode %}

The function returns the player's game mode. The target can only be an alias like `@p`, `@r` or `@s`.

Returns either `"survival"`, `"creative"`, `"adventure"` or `"spectator"`.

{% code lineNumbers="true" %}

```
-- With Alias
    get(player.name, @p)
```

{% endcode %}

### <i class="fa-lightbulb">:lightbulb:</i> Light

{% code lineNumbers="true" %}

```
get(light)
```

{% endcode %}

The function returns the light level at the block's position, ranging from 0 to 15.

### <i class="fa-mountains">:mountains:</i> Biome

{% code lineNumbers="true" %}

```
get(biome) -- Block Position
```

{% endcode %}

The function returns the biome at the block's position.

{% code lineNumbers="true" %}

```
get(biome, x, y, z) -- Custom Position
```

{% endcode %}

### <i class="fa-cube">:cube:</i> Block

{% code lineNumbers="true" %}

```
get(block, x, y, z)
```

{% endcode %}

The function returns the block at the coordinate's position.

{% hint style="info" %}
Targets can only be `@p`, `@r` and `@s`.
{% endhint %}


---

# 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/get-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.
