Scripting

The most important console commands for creating a script

Three commands that will always be used is Alias, Bind and Wait:
The Bind command assigns a key to execute a console command or A group of commands.
The Alias ​​command creates a new console command from an existing command or group of commands (31 symbol max).
The Wait command stop command parsing (execution) until next frame (present but blocked in CS:GO)

You can watch a list of all commands here

So a simple script:
alias hello echo Hello World!
bind h hello
alias is the announcement of the creation of a new command, you can also call it a function
“hello” is the name of the new console command, which will print the text “Hello World”. The name can be any, even numeric, you can call the command by typing its name in the console or assign a keyboard or mouse key to this command.
alias is the body of the function “h”
I will add a mouse button also add a sound command:
alias hello “echo Hello World! (keyboard); “
alias hello2 “echo Hello World! (mouse); “
bind “h” hello
bind “mouse3” hello2
I will also press “mouse4” and “mouse5” and enter the wrong name and you will see what the console will respond to it.
Syntax:
alias anyname1 command1
bind “any keyboard/mouse button” anynamy1
If there are several commands, they are enclosed in quotes and separated by semicolons:
alias anyname1 “command1; command2; command3; command#”
bind “any keyboard/mouse button” anyname1
example:
alias hello “echo Hello World !; echo Hello World2; echo Hello World3”
bind “h” hello
As I said, alias creates a new command, so this can also be combined:
alias anynamy1 “command1; command2; command3”
alias anynamy2 command4
alias anyname3 “anyname1; anyname2;”
bind “any keyboard / mouse button” anyname3
Add a message to the chat and an audio message:
alias hello “echo Hello World !; echo Hello World2; echo Hello World3”
alias hello2 say Hello World! CHAT
alias hello3 “spk hello”
alias run “hello; hello2; hello3”
bind “hello” run
Do not be alarmed if it is not clear yet I will analyze many real examples and you will learn how to write your own scripts.

Type of Scripts

Cycle scripts

This type of script is most often used to change settings. With one key you will be able to cycle through, and at the end will return to the starting position.
alias loop loop1 // Initial Name Of The Cycle Alias
alias loop1 “command1; command2; command #; alias loop loop2” // For each setting, assign commands and change the alias for the next loop
alias loope2 “command1; command2; command #; alias loop loop3” // Repeat several times
alias loope3 “command1; command2; command #; alias loop loop #”
alias loop # “command1; command2; command #; alias loop loop1” // Return to the original setting
bind “?” cycle
// Call key

Meta scripts

Executes a group of commands when a key is pressed and a group of commands when a key is released.
alias command1 “action1; wait; action2” // Alias for the first command
alias command2 “action3; wait; action4” // Alias for the second
alias +meta1 command1 // Call when the meta key is pressed
alias -meta1 command2 // Call when released
bind “h” +meta1 // Call key

Switch scripts

Switches operate on/off principle
alias anyname1 “command1; bind h anyname2” // action1
alias anyname2 “command2; bind h anyname1” // action2
bind “h” anyname1 // Toggle

Press&Relise scripts

The mechanism of these scripts is as follows: when you press a key, some commands are executed, and as soon as you release this key, others.
alias “+press” “command1; command2”
alias “-press” “command3; command4”
Pay particular attention to the “+” and “-“. They must be placed before the alias name, otherwise it is impossible to make a “press-release” script. The second alias is optional if no action is required when the key is released.
bind “?” “+press”
A simple radar example:
alias “+ radar” “drawradar”
alias “-radar” “hideradar”
bind “q” “+ radar
When you press the “q” button, the radar will appear and disappear if you release the button

Leave a Comment

Your email address will not be published.

twelve − four =

Latest Post

How to improve the sounds effects in the Counter-Strike 1.6 Sound Effects Tips Sounds are an integral part of any game, and …

Wally

Valve Hammer Editor

Half-Life Model Viewer

Half-Life Sprite Wizard

Half-Life Sprite Viewer

Facebook
Twitter
LinkedIn
VK