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

# Input & Sequence

> Four typing, mashing and sequence-entry games - Keymash, Keys, Number Up and Backdoor.

Four games built around keyboard input under pressure. Defaults live in `config/games/input.lua`.

<Info>
  Set any option as a server-wide default in `config/games/input.lua`, or pass it in a single call to change it just that once. Every game also accepts the [shared options](/resources/awoken-minigames/configuration/overview#shared-options) (`canCancel`, `title`, `theme`, ...) - see the [Overview](/resources/awoken-minigames/configuration/overview).
</Info>

***

## Keymash

Mash the shown key to fill a charge meter to 100%. It drains constantly, so keep mashing before it empties.

**Export:** `exports['awoken_minigames']:Keymash(opts)` - returns `true` only on a win.

| Option            | Default        | Notes                                                            |
| ----------------- | -------------- | ---------------------------------------------------------------- |
| `keys`            | `{ 'E', 'F' }` | Key pool; the prompt hops between these.                         |
| `requiredPresses` | `30`           | Presses to fill the meter from empty (`5`-`500`).                |
| `decayRate`       | `10`           | % of charge drained per second while idle (`1`-`100`).           |
| `timeLimit`       | `0`            | Total ms budget (`0` = no limit).                                |
| `canCancel`       | `true`         |                                                                  |
| `autoStart`       | `true`         | Starts immediately. `false` shows a "press to start" gate first. |

```lua Presets theme={"dark"}
-- Tutorial
exports['awoken_minigames']:Keymash({ keys = { 'E' }, requiredPresses = 20, decayRate = 5 })
-- Easy
exports['awoken_minigames']:Keymash({ keys = { 'E' }, requiredPresses = 30, decayRate = 8 })
-- Standard (defaults)
exports['awoken_minigames']:Keymash({})
-- Hard
exports['awoken_minigames']:Keymash({ keys = { 'E', 'F', 'R' }, requiredPresses = 45, decayRate = 16 })
-- Expert
exports['awoken_minigames']:Keymash({ keys = { 'E', 'F', 'R', 'G' }, requiredPresses = 60, decayRate = 22, timeLimit = 15000 })
```

<Tip>
  `decayRate` is the real difficulty dial - a faster drain is what makes players mash, more than a higher press count.
</Tip>

***

## Keys

A grid of letters lights up one at a time. Type each highlighted letter before the clock runs out, without too many mistakes.

**Export:** `exports['awoken_minigames']:Keys(opts)` - returns `true` only on a win.

| Option            | Default   | Notes                                                            |
| ----------------- | --------- | ---------------------------------------------------------------- |
| `count`           | `18`      | Letters to type (grid cell count) (`1`-`60`).                    |
| `timeLimit`       | `15000`   | Total ms budget (`0` = no limit).                                |
| `gridCols`        | `6`       | Grid columns (`2`-`10`).                                         |
| `letters`         | *(unset)* | Optional pool, e.g. `'ASDFJKL'`. Unset = A-Z.                    |
| `mistakesAllowed` | `2`       | Wrong presses tolerated before fail.                             |
| `canCancel`       | `true`    |                                                                  |
| `autoStart`       | `true`    | Starts immediately. `false` shows a "press to start" gate first. |

```lua Presets theme={"dark"}
-- Tutorial
exports['awoken_minigames']:Keys({ count = 8, timeLimit = 15000, gridCols = 4, mistakesAllowed = 3 })
-- Standard (defaults)
exports['awoken_minigames']:Keys({})
-- Hard
exports['awoken_minigames']:Keys({ count = 24, timeLimit = 15000, gridCols = 6, mistakesAllowed = 1 })
-- Expert
exports['awoken_minigames']:Keys({ count = 30, timeLimit = 14000, gridCols = 6, mistakesAllowed = 0 })
-- Home row only
exports['awoken_minigames']:Keys({ count = 16, timeLimit = 12000, gridCols = 4, letters = 'ASDFJKL' })
```

<Tip>
  Set `letters = 'ASDFJKL'` to keep everything on the home row - fairer on players who don't touch-type.
</Tip>

***

## Number Up

Click the scattered numbers in order, from 1 upward, before the clock runs out and without too many wrong clicks.

**Export:** `exports['awoken_minigames']:NumberUp(opts)` - returns `true` only on a win.

| Option            | Default | Notes                                                            |
| ----------------- | ------- | ---------------------------------------------------------------- |
| `count`           | `20`    | Highest number on the board (`4`-`50`).                          |
| `timeLimit`       | `30000` | Total ms budget (`0` = no limit).                                |
| `gridCols`        | `4`     | Grid columns (`3`-`8`); rows flow from `count`.                  |
| `mistakesAllowed` | `2`     | Wrong clicks tolerated before fail.                              |
| `canCancel`       | `true`  |                                                                  |
| `autoStart`       | `true`  | Starts immediately. `false` shows a "press to start" gate first. |

```lua Presets theme={"dark"}
-- Tutorial
exports['awoken_minigames']:NumberUp({ count = 10, timeLimit = 0, gridCols = 4, mistakesAllowed = 3 })
-- Standard (defaults)
exports['awoken_minigames']:NumberUp({})
-- Hard
exports['awoken_minigames']:NumberUp({ count = 25, timeLimit = 25000, gridCols = 5, mistakesAllowed = 1 })
-- Expert
exports['awoken_minigames']:NumberUp({ count = 30, timeLimit = 22000, gridCols = 6, mistakesAllowed = 0 })
-- Wide board
exports['awoken_minigames']:NumberUp({ count = 32, timeLimit = 35000, gridCols = 8 })
```

***

## Backdoor

Enter each key prompt in order - single keys or held combos - to clear each sequence before the shared clock runs out.

**Export:** `exports['awoken_minigames']:BackdoorSequence(opts)` - returns `true` only on a win.

| Option                | Default                            | Notes                                                            |
| --------------------- | ---------------------------------- | ---------------------------------------------------------------- |
| `requiredSequences`   | `3`                                | Sequences to clear (`1`-`10`).                                   |
| `sequenceLength`      | `5`                                | Prompts per sequence (`2`-`12`).                                 |
| `timeLimit`           | `20000`                            | Shared ms budget across all sequences (`0` = no limit).          |
| `maxAttempts`         | `3`                                | Wrong inputs tolerated before fail.                              |
| `timePenalty`         | `1500`                             | Ms removed from the clock per wrong input.                       |
| `minSimultaneousKeys` | `1`                                | Minimum keys per prompt (`>= 1`).                                |
| `maxSimultaneousKeys` | `2`                                | Maximum keys per prompt, held together.                          |
| `keys`                | `{ 'W', 'A', 'S', 'D', 'Q', 'E' }` | Key pool.                                                        |
| `keyHintText`         | `'Input the sequence to breach'`   | Hint text shown above the prompts.                               |
| `canCancel`           | `true`                             |                                                                  |
| `autoStart`           | `true`                             | Starts immediately. `false` shows a "press to start" gate first. |

```lua Presets theme={"dark"}
-- Tutorial
exports['awoken_minigames']:BackdoorSequence({ requiredSequences = 2, sequenceLength = 4, timeLimit = 0, maxAttempts = 5, keys = { 'W', 'A', 'S', 'D' } })
-- Standard (defaults)
exports['awoken_minigames']:BackdoorSequence({})
-- Combo locks
exports['awoken_minigames']:BackdoorSequence({ requiredSequences = 3, sequenceLength = 5, timeLimit = 22000, minSimultaneousKeys = 2, maxSimultaneousKeys = 3, keys = { 'W', 'A', 'S', 'D', 'Q', 'E' } })
-- Hard
exports['awoken_minigames']:BackdoorSequence({ requiredSequences = 4, sequenceLength = 6, timeLimit = 18000, maxAttempts = 2, timePenalty = 2000, maxSimultaneousKeys = 2 })
-- Expert
exports['awoken_minigames']:BackdoorSequence({ requiredSequences = 5, sequenceLength = 6, timeLimit = 20000, maxAttempts = 3, timePenalty = 2000, minSimultaneousKeys = 1, maxSimultaneousKeys = 3, keys = { 'W', 'A', 'S', 'D', 'Q', 'E', 'R', 'F' } })
```

<Tip>
  Raise `minSimultaneousKeys` to `2` to force held combos instead of single taps, and set `keyHintText` to re-theme it for your job.
</Tip>
