# Input

## Functions

### IsKeyPressed (Boolean)

Check if a key is currently pressed.&#x20;

{% hint style="info" %}
This is to check if a key is currently being pressed/held down.
{% endhint %}

#### Parameters

1. KeyCode (Integer)

#### Example

<pre class="language-lua"><code class="lang-lua"><strong>local TRUE = true
</strong><strong>local FALSE = false
</strong><strong>local isHoldingDownRightMouseButtonAkaRightClickForAimbotPurposes = FALSE;
</strong><strong>if IsKeyPressed(Key.MOUSELEFT) then
</strong><strong>    isHoldingDownRightMouseButtonAkaRightClickForAimbotPurposes = TRUE
</strong>else
    isHoldingDownRightMouseButtonAkaRightClickForAimbotPurposes = FALSE;
end
</code></pre>

### WasKeyPressed (Boolean)

Check if a key was pressed.&#x20;

{% hint style="info" %}
This is to check if a key WAS pressed. Use this if you're going to make keys toggle features, etc.
{% endhint %}

#### Parameters

1. KeyCode (Integer)

#### Example

<pre class="language-lua"><code class="lang-lua"><strong>local waterWalk = false
</strong><strong>if WasKeyPressed(Key.BACKSPACE) then
</strong><strong>    -- backspace was pressed, lets toggle water walk
</strong><strong>    
</strong><strong>    waterWalk = not waterWalk
</strong><strong>end
</strong></code></pre>

### GetMousePosition (FVector)

Get the coordinates of the mouse.

{% hint style="info" %}
X and Y will be -1 when the cursor is off the screen, on another monitor or not on the game window.
{% endhint %}

#### Example

<pre class="language-lua"><code class="lang-lua"><strong>local mouse_pos = GetMousePosition()
</strong><strong>if mouse_pos.X == 0 then
</strong><strong>    -- mouse one is at the very far left of the screen
</strong><strong>end
</strong></code></pre>

## Key

All key are pre-defined in the `Key` enum.

| Keys         |
| ------------ |
| BACKSPACE    |
| TAB          |
| ENTER        |
| PAUSE        |
| CAPSLOCK     |
| ESCAPE       |
| SPACE        |
| PAGEUP       |
| PAGEDOWN     |
| END          |
| HOME         |
| LEFT         |
| UP           |
| RIGHT        |
| DOWN         |
| INSERT       |
| DELETE       |
| 0            |
| 1            |
| 2            |
| 3            |
| 4            |
| 5            |
| 6            |
| 7            |
| 8            |
| 9            |
| A            |
| B            |
| C            |
| D            |
| E            |
| F            |
| G            |
| H            |
| I            |
| J            |
| K            |
| L            |
| M            |
| N            |
| O            |
| P            |
| Q            |
| R            |
| S            |
| T            |
| U            |
| V            |
| W            |
| X            |
| Y            |
| Z            |
| NUMPAD0      |
| NUMPAD1      |
| NUMPAD2      |
| NUMPAD3      |
| NUMPAD4      |
| NUMPAD5      |
| NUMPAD6      |
| NUMPAD7      |
| NUMPAD8      |
| NUMPAD9      |
| MULTIPLY     |
| ADD          |
| SUBTRACT     |
| DECIMAL      |
| DIVIDE       |
| F1           |
| F2           |
| F3           |
| F4           |
| F5           |
| F6           |
| F7           |
| F8           |
| F9           |
| F10          |
| F11          |
| F12          |
| NUMLOCK      |
| SCROLLLOCK   |
| LEFTSHIFT    |
| RIGHTSHIFT   |
| LEFTCTRL     |
| RIGHTCTRL    |
| LEFTALT      |
| RIGHTALT     |
| SEMICOLON    |
| EQUAL        |
| COMMA        |
| MINUS        |
| PERIOD       |
| SLASH        |
| GRAVEACCENT  |
| LEFTBRACKET  |
| BACKSLASH    |
| RIGHTBRACKET |
| MOUSELEFT    |
| MOUSERIGHT   |
| MOUSEMIDDLE  |


---

# 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.shulker.app/prismarine/lua-deprecated/functions/input.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.
