Studios
Minigamesmini-2.jpg

Commands & Exports

FreeMinigamesStandalone
PAGE 06 OF 08  ·  TROUBLESHOOTING → COMMANDS & EXPORTS → XP AND PERKSdocs.glitchstudios.dev
Browse docs

Commands#

The resource adds no player commands. With config.DebugCommands = true it registers test commands that anyone can run:

Command What
/testall [start] Runs every game in turn, optionally starting at a number in the list
/stoptest Stops /testall and cancels the running game
/testlockpick, /testdrill, /testplasma, /testcircuit, /testbruteforce, /testdatacrack [difficulty] One game each
/testfirewall, /testsequence, /testrhythm, /testsurge, /testvarhack, /testmemory, /testpairs and others One /test... command per panel game

Test commands award XP like a real game. Turn them off before players join.

Calling games#

Call game exports on the client, from a thread. Keep the argument order and pass nil for an argument you want to leave at its default. Every argument is optional, and any call can end with the options table described in Examples.

Every export returns false straight away when another game is running. Time units differ between games, so check the Defaults column.

Client game exports#

Export Arguments Defaults
StartFirewallPulse requiredHacks, initialSpeed, maxSpeed, timeLimit, safeZoneMinWidth, safeZoneMaxWidth, safeZoneShrinkAmount 3, 2, 10, 10 s, 40, 120, 10
StartBackdoorSequence requiredSequences, sequenceLength, timeLimit, maxAttempts, timePenalty, minSimultaneousKeys, maxSimultaneousKeys, customKeys, keyHintText 3, 5, 15 s, 3, 1.0, 1, 3
StartCircuitRhythm lanes, keys, noteSpeed, noteSpawnRate, requiredNotes, difficulty, maxWrongKeys, maxMissedNotes 4, chosen by the game, 150, 1000 ms, 20, 'normal', 5, 3
StartSurgeOverride possibleKeys, requiredPresses, decayRate { 'E' }, 50, 2
StartVarHack blocks, speed 5, 5
StartMemoryGame gridSize, squareCount, rounds, showTime, maxWrongPresses 5, 8, 3, 3000 ms, 3
StartSequenceMemoryGame gridSize, maxRounds, maxWrongPresses, showTime, delayBetween 4, 5, 3, 1000 ms, 300 ms
StartVerbalMemoryGame maxStrikes, wordsToShow, wordDuration 3, 50, 5000 ms. Returns { success, score, strikes }.
StartNumberedSequenceGame gridSize, sequenceLength, rounds, showTime, guessTime, maxWrongPresses 4, 6, 3, 4000 ms, 10000 ms, 3
StartSymbolSearchGame gridSize, shiftInterval, timeLimit, minKeyLength, maxKeyLength, symbolType 8, 2500 ms, 30000 ms, 1, 1, 'symbols'. Key lengths 1 to 6. Types include 'letters', 'numbers', 'emojis', 'dots', or a table of symbols.
StartPipePressureGame gridSize, timeLimit 6, 30000 ms
StartPairsGame gridSize, timeLimit, maxAttempts 4, 120000 ms, 0 (no limit)
StartMemoryColorsGame gridSize, memorizeTime, answerTime, rounds 5, 5000 ms, 10000 ms, 3
StartUntangleGame nodeCount, timeLimit 8, 60000 ms
StartFingerprintGame timeLimit, showAlignedCount, showCorrectIndicator 30000 ms, true, true
StartCodeCrackGame timeLimit, digitCount, maxAttempts 60000 ms, 4, 6
StartWordCrackGame timeLimit, wordLength, maxAttempts 120000 ms, 5, 6
StartBalanceGame timeLimit, driftSpeed, sensitivity, greenZoneWidth, yellowZoneWidth, driftRandomness, maxDangerTime 10000 ms, 3, 8, 30, 25, 2, 1000 ms
StartAimTestGame timeLimit, targetsToHit, targetLifetime, targetSize, shrinkTarget, maxMisses, timePenalty 30000 ms, 10, 1500 ms, 60 px, true, 5, 0 ms
StartCircleClickGame rounds, rotationSpeed, targetZoneSize, maxFailures, speedIncrease, randomizeDirection, keys, timeoutRotations 5, 2, 45 degrees, 3, 0.15, true, { 'W', 'A', 'S', 'D' }, 1
StartLockpickGame rounds, sweetSpotSize, maxFailures, shakeRange, lockTime, style 3, 30 degrees, 2, 40 degrees, 350 ms, config.LockpickStyle
StartBarHitGame key, rounds, speed, zoneSize, zoneStart, maxFailures, timeLimit, texts 'E', 3, 55, 20%, random, 3, 30000 ms, { success, fail }
StartSkillCheckGame keys, speed, timeLimit, zoneSize, perfectZoneSize, maxFailures, randomizeZone { 'E', 'F', 'R' } (one round per key), 65, 15000 ms, 18%, 5%, 1, true
StartNumberUpGame count, timeLimit, gridCols, maxMistakes 20, 30000 ms, 4, 3
StartKeysGame count, timeLimit, gridCols, maxMistakes, letters 18, 15000 ms, 6, 3
StartComboInputGame rounds, comboLength, timePerCombo, maxFailures, lengthIncrease 3, 4, 6 s, 2, 0
StartHoldZoneGame key, rounds, speed, zoneSize, perfectZoneSize, maxFailures, idleTimeout 'E', 3, 18, 18%, 0, 2, 10 s
StartWireConnectGame wireCount, timeLimit 8 (3 to 8), 0 s (no limit)
StartSimonSaysGame rounds, flashSpeed, timeLimit, maxMistakes 5, 550 ms, 20 s per round, 1
StartShapeRecallGame settings table { preset = 'normal' }
StartMemoryDiffGame settings table { preset = 'normal' }
StartTracerouteGame settings table { preset = 'normal' }
StartCarrierTuneGame settings table { preset = 'normal' }
StartBruteForce lives 5
StartDataCrack difficulty 2 to 5. Anything else uses the default speed.
StartCircuitBreaker levelNumber, difficultyLevel, delayStartMs, minFailureDelayTimeMs, maxFailureDelayTimeMs, disconnectChance, disconnectCheckRateMs, minReconnectTimeMs, maxReconnectTimeMs random level 1 to 6, difficulty 0, the rest from the difficulty
runMiniGame, runDefaultMiniGameFromDifficulty, runDefaultRandom Older Circuit Breaker entry points, kept for compatibility
StartDrilling options table { anim = 'jackhammer' } for the jackhammer, plus the per-call options
StartPlasmaDrilling difficulty, callback 5 (1 to 10). With a callback the export still waits, returns nil and passes the result to the callback.

Quit keys#

The panel games close on config.CancelKeys. The scaleform games use their own keys, which the controls HUD shows while they run. A quit counts as a loss.

Game Quit
Circuit Breaker Q
Data Crack Escape or Backspace
Fleeca Drilling Escape
Plasma Drilling Escape or Backspace
Brute Force No key. Choose Power Off on the desktop.

Settings-table presets#

Time fields are in milliseconds. Start from a preset and override only what you need.

startShapeRecall = {
    normal  = { tiles = 4, rounds = 4, questionsPerRound = 2, answerTime = 7000, numberTime = 1500, shrinkTime = 1500, maxStrikes = 0 },
    nopixel = { tiles = 4, rounds = 4, questionsPerRound = 2, answerTime = 7000, numberTime = 1500, shrinkTime = 1500, maxStrikes = 0, order = 'strict' },
    easy    = { tiles = 3, rounds = 3, questionsPerRound = 1, answerTime = 10000, numberTime = 2000, shrinkTime = 1500, maxStrikes = 1,
                questionTypes = { 'shape', 'shapeText', 'background' },
                palette = { 'black', 'white', 'blue', 'red', 'yellow', 'green' } },
    hard    = { tiles = 6, rounds = 6, questionsPerRound = 3, answerTime = 8000, speedUp = 400, numberTime = 1000, shrinkTime = 1000, maxStrikes = 1 },
},
startMemoryDiff = {
    normal  = { cols = 6, rows = 6, differences = 4, rounds = 1, mode = 'memory', memoriseTime = 5000, timeLimit = 20000, maxStrikes = 2, peeks = 1, peekTime = 1000 },
    nopixel = { cols = 6, rows = 6, differences = 4, rounds = 1, mode = 'side', timeLimit = 20000, maxStrikes = 2, peeks = 0 },
    easy    = { cols = 5, rows = 5, differences = 3, rounds = 1, mode = 'memory', memoriseTime = 7000, timeLimit = 25000, maxStrikes = 3, peeks = 2, peekTime = 1200 },
    hard    = { cols = 7, rows = 6, differences = 5, rounds = 2, mode = 'memory', memoriseTime = 4000, timeLimit = 15000, maxStrikes = 1, peeks = 0, subtle = true },
},
startTraceroute = {
    normal  = { cols = 10, rows = 6, ids = 8, extraLinks = 0.3, traces = 1, maxHops = 25, ttl = 30000, maxStrikes = 0 },
    nopixel = { cols = 10, rows = 6, ids = 8, extraLinks = 0.3, traces = 1, maxHops = 25, ttl = 30000, maxStrikes = 0 },
    easy    = { cols = 8, rows = 5, ids = 5, extraLinks = 0.4, traces = 1, maxHops = 30, ttl = 40000, maxStrikes = 1 },
    hard    = { cols = 12, rows = 7, ids = 14, extraLinks = 0.2, traces = 2, maxHops = 28, ttl = 25000, maxStrikes = 1, hiddenIds = true },
},
startCarrierTune = {
    normal  = { locks = 5, timeLimit = 40000, holdTime = 1500, holdDecay = 'drain', freqTolerance = 0.15, ampTolerance = 0.08 },
    nopixel = { locks = 5, timeLimit = 40000, holdTime = 1500, holdDecay = 'drain', freqTolerance = 0.15, ampTolerance = 0.08 },
    easy    = { locks = 3, timeLimit = 45000, holdTime = 1000, holdDecay = 'drain', freqTolerance = 0.25, ampTolerance = 0.12 },
    hard    = { locks = 5, timeLimit = 35000, holdTime = 2000, holdDecay = 'reset', freqTolerance = 0.1, ampTolerance = 0.05, drift = 0.4, noise = true },
},

Other client exports#

Export What
IsBusy() true while a game runs
OxSkillCheck(difficulty, inputs) Used by the ox_lib patch. Runs Circle Click with ox_lib skill check arguments.
CancelOxSkillCheck() Used by the ox_lib patch. Cancels a redirected skill check.
GetSoundThemes() Returns { active, configDefault, themes, sounds, info } for a sound picker
SetSoundTheme(name) Sets the sound theme on this client. nil goes back to config.ActiveSoundTheme. Returns false for an unknown theme.
PreviewSound(sound, theme) Plays 'click', 'buttonPress', 'penalty', 'success' or 'failure' in a theme, ignoring the player's mute

Server exports#

Export What
AwardXP(src, game, won) Gives the XP set for game in config.XP.Games, within the cooldown and hourly cap. Returns true when XP was given.
OpenXPSession(src, game, seconds) Lets the next client-reported result for game count within seconds (default 120, at most 600). Needed when RequireServerSession = true.
CloseXPSession(src, game) Drops an opened session.

Client events#

Event Direction What
glitch-minigames:controlsPanel You trigger (title, rows) shows the controls HUD for your own script. rows is nil to hide. Ignored while a game runs.
glitch-minigames:plasmaDrillComplete This resource fires (success) when a plasma drill ends
datacrack:start You trigger (difficulty, cb) for older scripts. Runs StartDataCrack with the busy lock and passes the result to cb.
datacrack This resource fires (success) when Data Crack ends, kept for older scripts

State bag#

LocalPlayer.state.hackTimeBonus, a number from 0 to 0.5, makes timed games last that share longer while it is set. Set it from the server with Player(src).state:set('hackTimeBonus', 0.05, true).

ox_lib skill check redirect#

Optional. Open ox_lib/resource/interface/client/skillcheck.lua. In lib.skillCheck, after if skillcheck then return end, add:

if GetResourceState('glitch-minigames') == 'started' then
    skillcheck = promise:new()
    local ok, result = pcall(function()
        return exports['glitch-minigames']:OxSkillCheck(difficulty, inputs)
    end)
    skillcheck = nil
    return ok and result == true
end

In lib.cancelSkillCheck, before the SendNUIMessage line, add:

if GetResourceState('glitch-minigames') == 'started' then
    exports['glitch-minigames']:CancelOxSkillCheck()
end

Apply it again after every ox_lib update. The redirect gives no hacking XP.