Skip to main content
Pattern Lock is a memory minigame where the UI plays a dot sequence on a grid and the player must repeat it in the same order before time runs out. Supports preset difficulties, custom configs, and multi-stage progressions.

Quick Start

Functions

Start a pattern lock minigame and wait for the result.
Parameters:
  • title (string, optional) - Title displayed in the header (default: 'Pattern Lock')
  • difficulty (string | table, optional) - Difficulty preset, custom config object, or array for multi-stage (default: 'medium')
Returns:
  • success (boolean) - true if all stages were completed successfully, false if failed, timed out, or cancelled
Cancel the currently active pattern lock.
Throws an error if no pattern lock is active.
Check if a pattern lock is currently active.
Returns:
  • isActive (boolean) - true if a pattern lock is active, false otherwise

Configuration

Options

title
string
Title displayed in the panel header
difficulty
string | table
default:"medium"
Difficulty preset, custom difficulty object, or array of presets/objects for multi-stage runsSee Difficulty Levels for available options
Multi-stage runs display a Stage badge in the header (e.g. Stage 1, Stage 2). The player must complete every stage to return true.

Difficulty Levels

Use predefined difficulty levels for quick setup.
easy
string
3x3 grid, 3-dot sequence, 700ms per dot, 10s input timeout
medium
string
3x3 grid, 5-dot sequence, 500ms per dot, 12s input timeout
hard
string
4x4 grid, 7-dot sequence, 350ms per dot, 14s input timeout
Example:
Multi-stage example:

Behavior

  • The same dot can appear more than once in a sequence, but never twice in a row
  • Pressing Escape fails the minigame
  • While active, the minigame captures full NUI focus (cursor + keyboard)

Preview

Pattern Lock Example