CS2 scripting behind the console

Scripting in Counter-Strike 2 Full Guide

bind, alias, toggle and incrementvar explained with examples, the four types of CS2 scripts, what changed in August 2024 and how to run scripts from a config, autoexec or launch options

Scripting in Counter-Strike 2 is built on binds, aliases and config files. A script doesn't play for you. It takes commands like bind, alias, toggle and incrementvar and turns them into cleaner, faster inputs: buy binds, radar zoom, telemetry on a key, practice configs.

After Valve's August 2024 update, automation of movement and shooting doesn't belong on official servers anymore, but normal binds and alias scripts are still part of every good setup. Below: the core commands with syntax, the four types of scripts with working examples, what changed in 2024 and how to load your scripts.

What Is a Script in CS2?

A script in CS2 is a set of console commands grouped together and tied to a key. A simple bind runs one command or a short chain. A script can remember a state, switch between modes and rebind keys. The main tool for that is alias: it lets you create your own small commands and link them together.

Type What it is Example
Bind A key that runs one command or a chain of commands bind "j" "cl_showfps 1"
Alias Your own command name for one command or a sequence alias "fps_on" "cl_showfps 1"
Script Binds, aliases and commands combined into one logic: toggles, cycles, modes A buy script, a radar zoom cycle, a telemetry toggle

A bind is simple and predictable. An alias gives you logic: for example, a key that switches between two crosshair sizes with every press. A script is the bigger system on top: a buy script can have several aliases and binds that set up your whole loadout with one key.

CS2 Scripting Commands and Syntax

The scripting commands bind, alias, toggle and incrementvar glowing on a futuristic console screen

Four commands do almost all the work. Get their syntax right and your scripts behave exactly as you expect. In my examples I use J, K and L, they are free in CS2 by default. C and V are the radio menus, X is the healthshot and X-Ray, so I avoid them.

bind

Puts a command or a chain of commands on a key. Full details in my bind tutorial.

bind "key" "command"
bind "key" "command1; command2; command3"
bind "j" "cl_showfps 1; echo FPS counter is on"

J turns on the FPS counter and prints a line in the console. Common key names: mouse1 to mouse5 for mouse buttons, mwheelup and mwheeldown for the wheel, space, ctrl, shift, tab, letters, numbers and F1 to F12. If you don't know a key's name, assign it in the settings menu and check it with key_listboundkeys.

alias

Gives a name to one command or a sequence. That's what turns simple binds into scripts.

alias "newcommand" "command1; command2; command3"
alias "fps_on" "cl_showfps 1"
alias "fps_msg" "echo FPS counter is on"
bind "j" "fps_on; fps_msg"

J runs cl_showfps 1 through fps_on, then the message through fps_msg. Aliases keep configs readable and let you reuse the same chain in several binds.

toggle

Switches a setting between two or more values with every press.

toggle setting value1 value2 value3
bind "j" "toggle cl_showfps 0 1 2 3"

Every press of J moves cl_showfps to the next value: 0, 1, 2, 3 and back to 0. Without values, toggle just flips a setting between 0 and 1. CS:GO also had bindtoggle, in CS2 it's a developer-only command, so use toggle instead.

incrementvar

Changes a value step by step inside a range. toggle jumps between fixed values, incrementvar moves in even steps.

incrementvar setting min max step
bind "k" "incrementvar volume 0 1 0.1"
bind "l" "incrementvar volume 0 1 -0.1"

K turns the volume up by 0.1, L down by 0.1. When the value hits the end of the range, it wraps around to the other end, so don't be surprised if the volume jumps from 1 to 0.

Other Useful Script Commands

Command What it does
unbind key Removes the bind from one key
unbindall Removes every bind, careful
binddefaults Restores the default key layout
exec name Runs a .cfg file from the cfg folder
echo text Prints text to the console, handy to check that a script ran
+name / -name An alias pair: + runs on key press, - on release
key_listboundkeys Lists all your current binds
find text Searches commands and settings by name
host_writeconfig Saves your current settings and binds right away

Types of CS2 Scripts With Examples

The script types Cycle Scripts, Press and Release Scripts and Meta Scripts glowing in a nebula

Not all scripts work the same way. Some are just a chain, others switch states, cycle values or work only while a key is held. Knowing the four main types makes it easy to pick the right structure.

1. Alias Chain Scripts

Split a long chain into small named parts and call them together. Easier to read and change than one long bind.

alias "set1" "cl_showfps 1; fps_max 400"
alias "set2" "echo Practice settings on; bind k fps_max 0"
alias "practice" "set1; set2"
bind "j" "practice"

J runs practice, which calls set1 and set2: FPS counter on, FPS limit set, a message in the console, and K is rebound to remove the FPS limit. One key, a whole group of actions.

2. Press and Release Scripts

Built on alias pairs with + and -. One part runs when you press the key, the other when you let go. Perfect for things that should only last while you hold a key.

alias "+bigradar" "cl_radar_scale 1"
alias "-bigradar" "cl_radar_scale 0.5"
bind "j" "+bigradar"

Hold J and the radar zooms out to the full map (scale 1), let go and it's back to 0.5. The scale range in CS2 is 0.25 to 1.

3. Cycle Scripts

Step through several values with repeated presses. The simplest way is aliases that rebind the same key to the next step.

alias "r1" "cl_radar_scale 0.25; bind l r2"
alias "r2" "cl_radar_scale 0.6; bind l r3"
alias "r3" "cl_radar_scale 1; bind l r1"
bind "l" "r1"

Every press of L: 0.25, 0.6, 1, back to 0.25. For this one setting toggle cl_radar_scale 0.25 0.6 1 does the same in one line, but the cycle pattern also works when each step needs several commands.

4. Advanced Alias Scripts (Modes)

Several aliases, binds and states in one structure. Usually used when one key switches another key between functions. More flexible, but needs clean logic and testing.

alias "next" "r1"
alias "r1" "cl_radar_scale 0.25; alias next r2"
alias "r2" "cl_radar_scale 0.6; alias next r3"
alias "r3" "cl_radar_scale 1; alias next r1"
alias "mode_on" "bind mouse2 next; echo Mouse2: radar zoom; alias mode mode_off"
alias "mode_off" "bind mouse2 +attack2; echo Mouse2: normal; alias mode mode_on"
alias "mode" "mode_on"
bind "j" "mode"

Press J once and the right mouse button cycles the radar zoom. Press J again and mouse2 is back to its normal job (scope, secondary attack). The trick is that J is bound to mode, and mode rewrites itself every time, that's what makes it switch back and forth.

How Scripting Changed: From CS 1.6 to the 2024 Rules

CS 1.6: Full Freedom

In CS 1.6 scripting was everywhere. GoldSrc gave far more freedom than Source or Source 2: with alias and wait people built movement loops, quick scope chains, anti-AFK scripts and all kinds of timed actions, all tied to the frame rate.

Source and CS:GO: Cleaner, Less Automation

Source made scripting cleaner. toggle, incrementvar and bindtoggle replaced a lot of long alias chains, while wait was disabled on official servers, which ended most timed scripts. Buy binds, radar toggles, net_graph switches, the jump throw bind and organized autoexec and config files became a normal part of most setups.

CS2 and the August 2024 Update

In July 2024 Razer added Snap Tap to its Huntsman V3 Pro keyboards: when you hold A and D, the keyboard counts only the last one pressed, so counter-strafing gets done for you. About a month later, on August 19, 2024, Valve answered with an update and a statement: automation through scripts or hardware that replaces core skills is not allowed anymore.

Multi-input binds

A bind or alias with more than one movement or attack command (jump, attack, duck, forward and so on) is now ignored. cl_allow_multi_input_binds 1 brings it back, but it's cheat-protected.

Hardware

Hardware-assisted counter-strafing is detected on official servers and gets you kicked from the match.

What's still fine

Normal binds, aliases, toggles, buy binds, radar and HUD scripts, practice configs. The rule is about automating gameplay, not about config customization.

So today CS2 scripting is mostly about quality of life: faster access to routine actions, a cleaner HUD, organized configs and practice setups. More on what still works for grenades in my jump throw guide, and why hardware macros fall under the same rule in the G HUB macros guide.

How to Run Your Scripts in CS2

You can paste a script into the console, but aliases are gone after a restart. It's better to keep scripts in a .cfg file and run it by hand or on every start.

1. Create the Config File

  1. Open the CS2 cfg folder:
    ...\steamapps\common\Counter-Strike Global Offensive\game\csgo\cfg\
  2. Create a text file with a simple name (letters, numbers, dashes, underscores), for example myconfig.txt.
  3. Rename it to myconfig.cfg . If you don't see extensions: File Explorer Options , View , uncheck Hide extensions for known file types .
    Windows File Explorer Options with Hide extensions for known file types and a cfg file in the folder
    How to show file extensions in Windows Explorer
  4. Open it in Notepad, paste your scripts and save.

2. Run It From the Console

  1. Turn on the console: Settings , Game , Enable Developer Console : Yes.
    CS2 settings screen with Enable Developer Console
    Enable the developer console in the game settings
  2. Press ~, type exec myconfig and hit Enter.
  3. Load a map, for example map de_dust2, and test.

3. Run It With Launch Options

Steam launch options for Counter-Strike 2 with +exec myconfig.cfg
Running a config from the Steam launch options

In Steam: right click Counter-Strike 2, Properties, General, Launch Options, and add +exec myconfig. The config now runs on every start.

4. Use autoexec.cfg

File explorer showing the path to autoexec.cfg in Counter-Strike 2 under game, csgo, cfg
autoexec.cfg lives in game\csgo\cfg

In the same cfg folder create autoexec.cfg. CS2 runs it on every start. Put your scripts straight into it, or load other files from it:

exec myconfig
echo "autoexec loaded"

The echo line is a simple check: if you see the text in the console after the game starts, autoexec ran. Details in my CS2 config guide and CS2 config location.

Conclusion

Scripting in Counter-Strike 2 is still useful, but its job has changed. Today it's about cleaner inputs, quick access to routine actions, an organized config and better practice setups. bind, alias, toggle and incrementvar cover almost everything, as long as the script helps you control the game rather than play it for you. Simple customization is part of every normal setup, automation that packs several gameplay actions into one input doesn't belong on official servers anymore.

CS2 Scripting FAQ

Can I get VAC banned for binds or aliases?

No. VAC looks for cheats that interfere with the game, not for built-in console commands. The 2024 rules can get you kicked from a match for automating movement or shooting, not banned for normal binds.

Why did some of my old scripts stop working?

Since August 19, 2024, binds and aliases with more than one movement or attack command (like +jump; -attack) are ignored on official servers. Scripts with one such command plus normal settings still work.

Does wait work in CS2?

No, CS2 doesn't have wait. Timed scripts are only possible with sleep inside exec_async, and that needs sv_cheats 1.

Does bindtoggle work in CS2?

No, in CS2 it's a developer-only command. Use bind "key" "toggle setting" instead.

What's the best way to load scripts?

autoexec.cfg for everyday play, the console (exec myconfig) for quick tests, launch options (+exec myconfig) if you want a config to run on every start without an autoexec.

My autoexec.cfg doesn't run, what's wrong?

Check the folder (game\csgo\cfg), the extension (.cfg, not .cfg.txt) and the exec lines for typos. Add echo autoexec loaded at the end to see if it runs.

How do I fix a broken bind in the middle of a game?

unbind key for one key, binddefaults for the default layout, unbindall only if you have a config ready to load right after.

Are practice scripts (noclip, grenade trajectory, bots) safe?

Yes. They need sv_cheats 1 or server rights, so they work on your own or a local server and simply do nothing on official ones.

Continue Reading

Leave a Reply

Your email address will not be published. Required fields are marked *