Article
by:
SoonUDie
[8:00
PM 03/11/01]
CounterStrike
has become my #1
addiction of late, so
I've decided to put up
this page in order to
help the beginning
scriptor.

First
of all, you might ask,
what is a script in
CounterStrike?
If
you've ever had
experience with the
"bind" console
command, this is just one
step further. Instead of
binding a standard action
like "+attack"
or "lastinv" to
a key, you will be
binding a group of
commands, to be executed
together in order.
You
can store your scripts in
many different config
files (*.cfg), but the
easiest method is just to
create one large
"AUTOEXEC.CFG".
To
check out a few of the
commands available to
you, take a look at your config.cfg
file in your half-life/cstrike
directory. The config.cfg
file contains all the
main user adjustable
settings to
CounterStrike, including
your BIND
commands. Take a look at
what each key is assigned
to.
Nows
let's actually make some
scripts!
We'll
start off by going to
your CSTRIKE directory.
Create a new text file by
selecting File -->
New --> Text Document.
You
should name the file
AUTOEXEC.CFG (get rid of
the .txt extension).
Since
this is a text file, open
up notepad and load
AUTOEXEC.CFG so we can
get to work.
The
syntax used when creating
scripts is very simple.
The first thing you start
with is the word alias
followed by the name
you want to give to the
script. After that comes
the commands which are
enclosed in parentheses.
A
lot of poeple ask about
BUY scripts which will
allow you to bind the
purchase of
weapons/equipment to one
key. This is a very handy
feature as it allows time
saving and can help you
win in a lot of
situations when rushing
is essential. They are
also not prone to human
error, so as long as you
remember which key is
which you won't end up
buying a flashbang
instead of an HE :)
Here's
an example of how you
might set up a buy
script:
//START OF
AUTOEXEC.CFG FILE
//
//You can use double
forward slashes like
these to
"comment" out
sections of your autoexec
file. This means that
they won't be confused
with the actual scripts
themselves and helps keep
everything problem free.
//
//***BUY ALIASES***
//
//
//*BUY Sig
alias buysig "buy;
wait; menuselect 4; wait;
menuselect 2; wait; buy;
wait; menuselect 6"
//
Let's
take a closer look at
this script here. I've
named it buysig
to keep it simple.
The
first thing the script
does is open the buy menu
[buy].
It then selects menu item
number four [menuselect
#], in this
case, Rifles. It
then selects option
number two, which is the
Sig 550 for $3500. After
that, it opens the buy
menu a second time and
selects menu item number
6, BUY PRIMARY AMMO,
which will buy the
maximum ammount of ammo
(you can afford) for your
gun. The wait commands
are just there as a
standard procedure to
counter lag. The number
of wait commands should
vary depending on your
lag; the more lag there
is, the more waits there
should be.
At
this point I have to end
the article temporarily
due to time constraints,
but you should try to use
and remember the
following commands:
buy
- opens the buy menu
buyequip
- directly opens the buy
equipment menu
menuslect
# - selects the menu
option #, when # is a
number =P
After
you have your scripts
written in your
Autoexec.cfg file, go in
to your config.cfg file
and edit the bind
controls. Set a key to
bind to your script by
using its name. Example:
bind
"F3"
"buysig"
The
syntax for the config.cfg
file is a bit different
but I'm sure you can live
with it :)
I've just
finsihed playing around
with my autoexec.cfg and
config.cfg, so that I
could use them as
examples... here's
the result. The download
is 3 freaking kilobytes.
Just copy
what I've done and you'll
find that scripting isn't
really that hard.
|