# The Worm

<figure><img src="https://816912809-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHaTfLRA7uCNOQ4cIXQD2%2Fuploads%2Ff0aTFTWH2vTVWvpuIiuv%2Fimage.png?alt=media&#x26;token=15aad1dc-9a85-4ba2-94e2-5f67a6cf429b" alt=""><figcaption></figcaption></figure>

***

## Basic Information

* Values used for the minigame
  * Time Limit
    * Max amount of time, in seconds, to finish the objective
  * Difficulty
    * Determines how many barriers spawn
  * Target Score
    * Amount of data to collect to succeed

***

## Exports (client side only)

### Default Settings

```lua
-- Using preset difficulty of 'hard'
exports['envi-hack-minigames']:StartWormHack('hard', function(success)
    if success then
        print('Worm hack completed successfully!')
    else
        print('Worm hack failed!')
    end
end)
```

### Custom Settings

```lua
-- Using custom settings
exports['envi-hack-minigames']:StartWormHack({
    timeLimit = 180,
    difficulty = 3,
    targetScore = 20
}, function(success)
    if success then
        print('Worm hack completed successfully!')
    else
        print('Worm hack failed!')
    end
end)
```

### Getting Defaults and Hack Skill

```lua
-- Get default settings for difficulty
local hackType = 'worm'
local difficultyPreset = 'medium'
local defaults = exports['envi-hack-minigames']:GetHackDefaults(hackType, difficultyPreset)

-- Adjust difficulty
-- Can be adjusted however you wish based on whatever parameters you decide
defaults.difficuly = defaults.difficuly - 1

-- Start the hack with the adjusted default settings
exports['envi-hack-minigames']:StartWormHack(defaults, function(success)
    if success then
        print('Hack Success!')
    else
        print('Hack Failed!')
    end
end)
```
