The Bind Command
Bind is the most important command in any
config, without it you basically can't do anything.
Before we start writing the config it's important that you
understand bind and alias.
Binding Keys
Bind is used to tell Q2 what you want a key to
do, it basically allows you to set up your keyboard configuration
from within a config file, but since you have much more freedom in
the config file you can set keys to do things that cannot be
selected in the menus such as broadcasting custom messages.
bind pause
"screenshot" //Take
Screenshot
The above example would tell Q2 that when you
press the pause key (above page up) to take a screenshot.
Note the way the command is laid out, this is how most commands
should be laid out: Firstly, there's the command itself
bind
Then, the key that is to be bound
pause
Then there is a section in speech marks (these
are not essential for simple commands such as this but it is good
to get into the habit of using them in all commands because they
become vital later when you create more complex scripts with the
alias command), this tells Q2 what command you want it to do when
the key is pressed.
"screenshot"
The part at the end after the // is a comment, it is not required and is ignored by
Q2 (anything in a config preceded by // is
ignored). It is called a comment and is put there to allow you to
easily find what everything does in your config. Commenting your
work is another good habit to get into because it means that if you
ever need to change anything you can easily find it without having
to look too closely at cryptic commands, an organized config makes
finding things easier too - if you follow the guides on making your
config you'll see how to organize it.
Holding Keys: +/-
A lot of commands work like above where you
press the button and the command is executed, you press it again
and it's executed again, but for some commands this is
inappropriate.
If you want to walk forward you can't just press the key for each
step, you want to be able to hold down the key and continue walking
forward untill it is released, then you want to stop. This is
achieved using a '+' before the 'forward' command:
bind uparrow
"+forward" //Move
Forward
This tells Q2 that you want the 'forward'
command to remain active as long as you hold down uparrow (the up
pointing arrow on the right of the keypad below end), when you
release uparrow the game will execute '-forward' telling your
character to stop moving (Q2 automatically binds '-' commands so
you don't need to, handy really since there is no way to do
it!).
Common uses for +/- binds are movement keys and
the trigger, although they can be used in some more complex
scripts.
Multiple Commands: ;
It is possible to group commands together in
one binding allowing you to execute more than one command with a
single keypress, when doing this the ; symbol is used as a
seperator for commands.
bind f12 "radioteam reportin;wave 1;say_team ...I'm
alive with %H health..."
This will tell Q2 that when you press F12 it
has to play the file reportin.wav to your team, salute, and send
the message to your team saying you're alive and informing them of
your health status. All three things will happen at once with no
delay between them.
PREV NEXT
|