Getting started
evasive runs Lua 5.4 scripts inside its CS2 overlay. A script can draw on the screen, add its own settings to the menu and read the game: players, the bomb, the camera and the map. With extra permissions it can also make web requests, run its own shaders or press keys for you.
This page shows where scripts live and how you load them. When you know your way around, go on to Your first script.
Where scripts live
Every script is one .lua file in the scripts folder:
Documents\evasive\scripts\A few folders inside it have a fixed job:
| Folder | What goes in it |
|---|---|
scripts\ |
Your scripts. One file is one script. |
scripts\lib\ |
Shared modules you load with require("name"). require also finds files next to the script. |
scripts\data\<script>\ |
The script's own folder for files and storage, up to 8 MiB. |
scripts\fonts\ |
TTF and OTF fonts for draw.load_font. |
You can drop a .lua file into the folder by hand, or make one from the menu.
The Scripts tab
Open the menu and pick Scripts. The tab has three pages: Scripts, Settings and Console. Its header shows how many scripts are running and how much of the frame budget they use, for example 2 running · 0.21 / 1.00 ms.
Scripts
The Local box lists the files in your scripts folder.
- Double-click a script, or press its play button, to load it. Do it again to unload it. Unload all stops every script.
- A green name is running. The number next to it is the time it takes each frame.
- A red name stopped. It either hit an error or was suspended for using too much time or memory. The console says which.
- The pencil opens the file in the built-in editor. In the editor, F5 saves and runs the script and Ctrl+S only saves it.
- The + button makes a new script from a template and opens it in the editor. A name can have letters, digits, spaces, dots, dashes and underscores, up to 32 characters.
- The refresh button reads the folder again, for example after you copied a file in.
The Workshop box lists scripts you subscribed to on the website. They update by themselves, but nothing runs until you load it.
The Security box holds the six permission switches. They decide what scripts may touch. See Permissions.
The Other box has three options:
| Option | What it does |
|---|---|
| Load with configurations | Your configs remember which scripts are loaded and how they are set, so loading a config loads that set. |
| Reload on file change | A loaded script reloads every time its file is saved, also from another editor. |
| Script budget | How much time per frame all scripts get together, from 0.25 to 4 ms. The default is 1 ms. |
Settings
Every control a script adds with ui.checkbox, ui.slider and the other ui functions shows up here, one box per script. The values are saved in your config like any other setting. Your own settings shows how to add them.
Console
Everything your scripts print, and every error with its line number, lands here. Pick a script under Show to see only its lines. The icons in the box title copy or clear what is shown.
The two boxes above the console, Action activity and Script actions, are for scripts that aim, shoot or press keys. Aim, attack and keys explains them.
Work in your own editor
The built-in editor is fine for small changes. For anything bigger, turn on Reload on file change in Scripts > Other and open the file in the editor you like. Every time you save, the script reloads in game and any error shows up in the console at once.
Script headers
Comment lines at the very top of a file, before the first line of code, can describe the script. All of them are optional.
-- @name My script
-- @author me
-- @version 1.0
-- @description What it does, in one line.@name is what the script list and script.name show. Without it the file name is used. Values are cut at 128 characters. A script that aims, shoots or presses keys also needs the line -- @permissions act, covered in Aim, attack and keys.
Next
- Your first script walks you through making and running one.
- How scripts run explains callbacks, the time budget and errors.