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

# Exports

> How to start a game from your own script - one line, and it tells you whether the player won.

Every game is started the same way: one line of code that runs the game and, when the player finishes, tells you `true` if they won or `false` if they didn't.

```lua theme={"dark"}
local passed = exports['awoken_minigames']:SkillCheck({ keys = { 'E', 'F', 'R' } })
```

Learn that one line and all 68 games work the same way - only the name and the options in the `{ }` change. Every game's options are listed on its [configuration page](/resources/awoken-minigames/configuration/overview).

<Info>
  You call these from a **client** script. There are also a couple of extras: a way to [check a win on your server](/resources/awoken-minigames/server-verification), and [`Sequence`](/resources/awoken-minigames/sequences) for running several games in a row.
</Info>

## A few things worth knowing

<AccordionGroup>
  <Accordion title="Wrap it in CreateThread" icon="hourglass">
    The line waits for the player to finish before it carries on, so put it inside a `CreateThread` (the standard FiveM way to run something that waits):

    ```lua theme={"dark"}
    CreateThread(function()
        local passed = exports['awoken_minigames']:HexBreach({ daemons = { 3 } })
        if passed then
            -- they won: open the vault, pay out...
        else
            -- they didn't: trip the alarm, lock them out...
        end
    end)
    ```
  </Accordion>

  <Accordion title="Only one game at a time" icon="layer-group">
    If a game is already on screen, starting another does nothing and returns `false`. If two systems might overlap, check first with `IsActive`:

    ```lua theme={"dark"}
    if not exports['awoken_minigames']:IsActive() then
        exports['awoken_minigames']:Stack({ targetHeight = 15 })
    end
    ```
  </Accordion>

  <Accordion title="What you pass changes just that one game" icon="sliders">
    Any options you pass apply to that single game and override the server defaults. Leave the `{ }` empty to use your defaults exactly as set:

    ```lua theme={"dark"}
    exports['awoken_minigames']:Snake({})  -- uses the config defaults
    ```
  </Accordion>

  <Accordion title="false covers everything that isn't a win" icon="circle-xmark">
    `false` means the player didn't win - whether they failed or pressed <kbd>ESC</kbd> to back out. It doesn't say which, which is what you want for most jobs: they didn't do it, so it didn't happen. To stop them backing out at all, set `canCancel = false`.
  </Accordion>
</AccordionGroup>

## Shared options

On top of its own options, every game accepts these. See [Configuration → Shared options](/resources/awoken-minigames/configuration/overview#shared-options).

| Option      | Default    | What it does                                                                                                         |
| ----------- | ---------- | -------------------------------------------------------------------------------------------------------------------- |
| `canCancel` | `true`     | Whether <kbd>ESC</kbd> cancels. A cancel returns `false`.                                                            |
| `autoStart` | per game   | `false` shows a "press to start" gate first; `true` starts immediately.                                              |
| `title`     | per game   | Card title.                                                                                                          |
| `subtitle`  | per game   | Line under the title.                                                                                                |
| `brand`     | `'Awoken'` | Kicker above the title.                                                                                              |
| `theme`     | `'dark'`   | UI look for this call.                                                                                               |
| `volume`    | `0.4`      | SFX volume, `0`-`1`.                                                                                                 |
| `muted`     | `false`    | Mute this call.                                                                                                      |
| `minimal`   | `false`    | Strip the card to a HUD prompt. See [Minimal mode](/resources/awoken-minigames/configuration/overview#minimal-mode). |

## Two helpers

### IsActive

Tells you `true` if a game is currently on screen. Handy to avoid starting one on top of another.

```lua theme={"dark"}
local busy = exports['awoken_minigames']:IsActive()
```

### FishingResult

Most games just tell you win or lose. **Fishing** can also tell you **how many fish the player landed**, so someone who lands 2 of 3 can still be paid for 2:

```lua theme={"dark"}
CreateThread(function()
    local r = exports['awoken_minigames']:FishingResult({ fishCount = 3 })

    for i = 1, r.caught do
        -- pay out per fish, even for a partial haul
        TriggerServerEvent('myfishing:landed')
    end
end)
```

You get back `r.caught` (how many they landed), `r.total` (how many there were), `r.success` (`true` only if they got them all), and `r.cancelled` (`true` if they pressed <kbd>ESC</kbd>).

## Every game's export name

Options and defaults for each game live on its category page.

### Reaction & precision

[Options →](/resources/awoken-minigames/configuration/reaction)

`SkillCheck` · `CircleClick` · `HoldZone` · `AimTest` · `Balance` · `Rhythm` · `FirewallPulse` · `SafeCrack` · `Lockpick` · `Osu` · `Slider`

### Input & sequence

[Options →](/resources/awoken-minigames/configuration/input)

`Keymash` · `Keys` · `NumberUp` · `BackdoorSequence`

### Memory

[Options →](/resources/awoken-minigames/configuration/memory)

`SimonSays` · `Memory` · `MemoryColors` · `VerbalMemory` · `NumberedSequence` · `VarHack` · `Pairs` · `Recall` · `Observe` · `Tally` · `ChromaLock` · `PitchLock`

### Logic & hacking

[Options →](/resources/awoken-minigames/configuration/logic)

`LightsOut` · `HexBreach` · `CodeCrack` · `Fingerprint` · `WordCrack` · `SymbolSearch` · `PipePressure` · `Untangle` · `Minefield` · `Jigsaw` · `Wires` · `TowerOfHanoi` · `MathRush` · `Twenty48` · `Splice` · `Current` · `DataStream` · `Collapse` · `ArrowMaze`

### Arcade

[Options →](/resources/awoken-minigames/configuration/arcade)

`Snake` · `Flappy` · `Stack` · `Pong` · `Invaders` · `Crossy` · `Ascent` · `Slipstream` · `Breakout` · `StickIt` · `MatchIt`

### Precision

[Options →](/resources/awoken-minigames/configuration/precision)

`Track` · `Trace` · `Cut` · `Calibrate` · `Waveform` · `Thread` · `Reach`

### Dexterity

[Options →](/resources/awoken-minigames/configuration/dexterity)

`Shake` · `Cascade` · `Fishing` · `Cooldown`

<Info>
  Each game has one export name, shown above (like `SkillCheck` or `HexBreach`). The same name in the config files is written lower-case-first - `skillCheck`, `hexBreach`.
</Info>

## Recipes

### Gate a heist step

```lua theme={"dark"}
CreateThread(function()
    if exports['awoken_minigames']:CodeCrack({ codeLength = 5, symbols = 7 }) then
        TriggerServerEvent('myheist:vaultCracked')
    else
        TriggerServerEvent('myheist:alarmTripped')
    end
end)
```

### Scale difficulty by tier

One call, a couple of numbers. Every game's page lists its ranges.

```lua theme={"dark"}
local TIERS = {
    easy   = { zoneSize = 26, speed = 45, mistakesAllowed = 2 },
    normal = { zoneSize = 18, speed = 65, mistakesAllowed = 1 },
    hard   = { zoneSize = 11, speed = 90, mistakesAllowed = 0 },
}

local function skillCheckFor(tier)
    return exports['awoken_minigames']:SkillCheck(TIERS[tier])
end
```

### Make it un-cancellable

```lua theme={"dark"}
exports['awoken_minigames']:Stack({
    targetHeight = 20,
    canCancel    = false,  -- ESC won't get them out of it
})
```

### Chain several games

You can run games one after another - each line waits for the last to finish:

```lua theme={"dark"}
CreateThread(function()
    if not exports['awoken_minigames']:Fingerprint({ timeLimit = 20000 }) then return end
    if not exports['awoken_minigames']:HexBreach({ daemons = { 3 } })     then return end
    if not exports['awoken_minigames']:Wires({})                          then return end

    TriggerServerEvent('myheist:complete')
end)
```

For anything more than a step or two, the built-in [`Sequence`](/resources/awoken-minigames/sequences) export does the same thing more neatly - one call, one result, with a "Stage 2 of 3" banner for the player.

### Re-skin a game for your job

The title, subtitle and brand can be set per call, so the same game can be a bank hack in one place and a lab puzzle in another:

```lua theme={"dark"}
exports['awoken_minigames']:PipePressure({
    title    = 'Coolant Loop',
    subtitle = 'Restore the flow before the core melts',
    brand    = 'Humane Labs',
})
```
