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

# Sequences

> Run several different games in a row as one call - the tidy way to build a multi-step hack.

`Sequence` runs several games **back to back as one call**. Every stage must pass; the first failure or cancel ends the run there and the rest are never played. You get a single `true`/`false` back.

The stages can be **different games** - that's the whole point. A vault door can be "pick the lock, breach the panel, patch the wires" without your resource writing any glue, tracking state between games, or handling a player who cancels halfway.

<Info>
  This is different from [multi-stage games](/resources/awoken-minigames/configuration/overview#multi-stage-games), where one game repeats N times via `stages`. A **Sequence** chains *different* games; a game's own `stages` repeats the *same* game.
</Info>

## The call

**Export:** `exports['awoken_minigames']:Sequence(opts)` - returns `true` only if **every** stage passed.

```lua theme={"dark"}
CreateThread(function()
    local passed = exports['awoken_minigames']:Sequence({
        label  = 'Vault Entry',
        stages = {
            { game = 'lockpick',  config = { rings = 3 } },
            { game = 'hexBreach', config = { gridSize = 5 } },
            { game = 'wires',     config = { pairs = 4, timeLimit = 25000 } },
        },
    })

    if passed then
        -- the player cleared all three
    end
end)
```

| Argument    | Default        | Notes                                                                 |
| ----------- | -------------- | --------------------------------------------------------------------- |
| `stages`    | *(required)*   | Array of `{ game = '<id>', config = { ... } }`. Max **10**.           |
| `label`     | *(none)*       | A name for the whole run, shown on the stage banner ("Stage 2 of 3"). |
| `canCancel` | `true`         | <kbd>ESC</kbd> cancels the whole run.                                 |
| `brand`     | `'Awoken'`     | Kicker above the title.                                               |
| `theme`     | config default | Applies to every stage.                                               |

The `game` is the game's name (the same one used in `config/games/`): `lockpick`, `hexBreach`, `wires`, `snake`, and so on. `config` is that game's own options - the same ones on its config page. Leave `config` out to use your server defaults for that game.

## What it handles for you

* The player flows straight from one game into the next - no "press to start" between stages.
* Games can mix keyboard and mouse freely: the cursor is handled for each stage, so `{ snake, aimTest, keys }` (keyboard, mouse, keyboard) just works.
* A typo in a game name is skipped with a console warning rather than breaking your script.

## Reward getting partway

`Sequence` gives you `true` or `false`. If you'd rather reward a player for the stages they *did* clear, use **`SequenceResult`** instead - same run, but it tells you how many they finished:

```lua theme={"dark"}
CreateThread(function()
    local result = exports['awoken_minigames']:SequenceResult({
        label  = 'Vault Entry',
        stages = {
            { game = 'lockpick',  config = { rings = 3 } },
            { game = 'hexBreach', config = { gridSize = 5 } },
            { game = 'wires',     config = { pairs = 4 } },
        },
    })

    for _ = 1, result.stagesCompleted do
        -- pay out per stage cleared, even if the run failed later
    end
end)
```

You get back `result.stagesCompleted` (how many they cleared), `result.totalStages` (how many there were), and `result.success` (`true` only if they cleared them all).

## Checking a sequence on your server

A chain counts as one thing. If you [verify the win on your server](/resources/awoken-minigames/server-verification), the game name to use is `'sequence'`:

```lua theme={"dark"}
-- your server
if not exports['awoken_minigames']:ConsumeResult(src, 'sequence') then return end
```

<Tip>
  Test chains from the dev menu - it has a **Sequences** section with ready-made presets, including a *Mixed Input* chain (keyboard → mouse → keyboard) that exercises the cursor swap. Open it in-game with `/awoken_minigames`.
</Tip>
