1. IntroductionWelcome to the complete guide for creating custom commands in Source Engine.
This tutorial will completely cover the use of the
2. The Basics
alias customcommandname "command ; command ; command"You put your custom command name instead of
customcommandnameand use the cvars you need instead of
command,while separating them with a
2.2. UsesCreating timed screenshots,quickly changing lots of cvars,binds and much much more. This thing is overall the magic fix for bind like quick grenade.because it requires execution of many commands at once. Everyone who wrote scripts for HL2 can't deny it's one of the most useful commands there.
2.3. The rulesLet's quickly give you a rundown of what is possible and what is not.
alias command 0 "command ; command"This will result in the engine interpreting the
0as the command you're trying to execute.
alias command "alias command2 "command ; command""This will utterly break the engine as it can't comprehed double and onwards
alias command_bluh "command ; command"This will be interpreted by the engine just fine - this is replacing the spaces in the commands.
From the previous sentence you probably figured a way to create 0 and 1 commands.
alias command_0 "command ; command"This will be interpeted completely correctly by the engine.
alias command_1 "command ; command"
3. Fancy Techniques
3.1. "Hold Commands"Interesting mechanic. The movement is realised with it.
Let's break it down:
But how does it stops when you're not pressing W? Simple - there is a
-forward command. The engine will assing
-to eachother if the command names are the same.
So to use it simply create a
+commandand -command and bind them to a key afterwards. The game will do the other work for you,just press the assigned key.
3.2. Double Alias WorkaroundSo there is somewhat a workaround for double aliases. What you need to do is simple - just create another .cfg file with alias in it and include the
exec 2alias.cfgcommand into the alias.
alias command "command ; exec 2alias.cfg ; command"