Half-Life - Counterstrike

Half-Life - Counterstrike

14.10.2013 20:32:01
_______________________________________________________________________________
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
HALF-LIFE: COUNTERSTRIKE SCRIPTING FAQ
Version 0.1 (06/01/2001)
Copyright 2001 Pierre-Hugues Goyet
_______________________________________________________________________________
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯


/***
* Webmasters, feel free to post this FAQ on your web sites. All I'm asking in
* in return is a link to where it's hosted and your word that you won't edit
* or modify it in any way. Also, please try to keep it updated as much as
* possible. You can always find the latest version at http://www.gamefaqs.com
*/



-------------------------------------------------------------------------------
INDEX
-------------------------------------------------------------------------------


I. Introduction
II. Basics
III. Binding
IV. Aliases
V. Scripting
VI. Samples
VII. Requests
VIII. User Submitted
IX. FAQ
X. Final Words
XI. Credits
XII. Version History




-------------------------------------------------------------------------------
I. INTRODUCTION
-------------------------------------------------------------------------------


What exactly is scripting? A common misconception is to think it's a form
of cheating. Let me reassure you right away: it is not. You can't make a
script that gives you automatic headshots, no recoil, super fast speed, etc.
All these require external programs running in the background that typically
mess with your system memory, keyboard/mouse input or the game's binary files.
THAT is cheating. Scripting is not.

Scripting requires no external programs or illicit activities. It is merely
using the finer features of the Half-Life engine as well as its console to
their fullest. A script will simply execute console commands for you that
aren't present in the Configuration menu. That's why it's not cheating unless
the game has cheat commands accessible from the console, and that isn't the
case.

Typically, scripts are used to automatically perform certain tasks for you
during your playing routine, for example buying your equipment (buy scripts
are the most common in the CS community). In that essence, your config.cfg
(the file that is created/overwritten whenever you go into the Configuration
menu and change your settings) is a script since it binds all your keys to the
functions you have chosen automatically.

They can also be used to modify (to a certain extent) existing functions.
For example, you might want to make your gun burst fire on its own, or
transform your walk button into a toggle rather than the default press & hold,
etc. You can do a lot of things, use your imagination.

Remember that if what you want can't be done manually through console
commands, a script won't be able to do it either.




-------------------------------------------------------------------------------
II. BASICS
-------------------------------------------------------------------------------


There are 2 kinds of functions in the Half-Life engines, basically. Normal
functions and +functions. There are also settings AKA variables, but we'll
talk about those later.

Normal functions are fairly simple: once they're invoked, they're executed
once and that's the end of it. +functions are a bit more complicated. First,
they always have a -function counterpart that USUALLY (but not necessarily)
does the opposite of what the +fuction does. For example, +attack tells the
engine to make your player start firing, and -attack stops firing. When you
press the key assigned to a +function, the +function is executed. When you
release that key, the -function is executed.

I know this is an awfully short explanation, but for the sake of simplicity
and for making basic scripts, that's all you need to know.




-------------------------------------------------------------------------------
III. BINDING
-------------------------------------------------------------------------------


The principle of binding is extremely simple. What you do is assign a key
to invoke a function, an alias or a series of functions and aliases. Here's
an example demonstrating the syntax:


bind "MOUSE1" "+attack"


If you're invoking multiple functions/aliases, you need to seperate them
with semicolons. For example:


bind "Q" "say hi people; say_team hello team"


would make pressing Q send out the message "hi people" to everyone and
"hello team" to your teammates only.


Here's a relatively complete list of the keys you can bind. Big thanks to
gameFAQs board user bassfish for the original list. Slight modifications were
made by myself.

NOTE: "Ingame Key Name" is how the Half-Life engine refers to the keys that
we puny mortals sometimes call differently ("Out of Game Key Name").
Also, I'm fairly certain that the Escape key is reserved.


Ingame Key Name / Out of Game Key Name

ESCAPE Escape
F1 F1
F2 F2
F3 F3
F4 F4
F5 F5
F6 F6
F7 F7
F8 F8
F9 F9
F10 F10
F11 F11
F12 F12
PAUSE Pause / System Break Key
` Left Quote
- Hyphen (-)
= Equals Sign
BACKSPACE Backspace
TAB Tab Key
[ Left Bracket
] Right Bracket
\ Back Slash
SEMICOLON Semicolon (;)
' Right Quote
/ Slash
SHIFT Left *AND* Right Shift Keys
ENTER Enter
, Comma (,)
. Period (.)
CTRL Left *AND* Right Control Keys
ALT Left *AND* Right Alt Keys
SPACE Space Bar
1 1 (above letters)
2 2
etc. etc.
0 0
A A
B B
etc. etc.
Z Z
UPARROW Up Arrow NOT Keypad
DOWNARROW Down Arrow NOT Keypad
RIGHTARROW Right Arrow NOT Keypad
LEFTARROW Left Arrow NOT Keypad
INS Insert NOT Keypad
HOME Home NOT Keypad
PGUP Page Up NOT Keypad
PGDN Page Down NOT Keypad
DEL Delete NOT Keypad
END End NOT Keypad
KP_UPARROW Keypad Up Arrow Keypad
KP_PGUP Keypad Page Up Keypad
KP_LEFTARROW Keypad Left Arrow Keypad
KP_5 Keypad 5 Keypad
KP_RIGHTARROW Keypad Right Arrow Keypad
KP_END Keypad End Keypad
KP_DOWNARROW Keypad Down Arrow Keypad
KP_PGDN Keypad Page Down Keypad
KP_ENTER Keypad Enter Keypad
KP_INS Keypad Insert Keypad
KP_DEL Keypad Del Keypad
KP_SLASH Keypad Back Slash Keypad
KP_MINUS Keypad Hyphen Keypad
KP_PLUS Keypad Plus Keypad
MOUSE1 Mouse Button 1
MOUSE2 Mouse Button 2
MOUSE3 Mouse Button 3 Middle button
MOUSE4 Mouse Button 4
MOUSE5 Mouse Button 5
MWHEELUP Mouse Wheel Up (Roll Forward)
MWHEELDOWN Mouse Wheel Down (Roll Back)




-------------------------------------------------------------------------------
IV. ALIASES
-------------------------------------------------------------------------------


Aliases are fairly simple to understand. They are merely another way to
refer to a series of functions or other aliases. A nickname, if you like.
For example, compare the following 2 mini-scripts:


1) bind "X" "buy; menuselect 1; menuselect 3"

2) alias "buy_deagle" "buy; menuselect 1; menuselect 3"
bind "X" "buy_deagle"


What's the difference? Both do the same thing: make the X key buy you a Desert
Eagle. It's just that the second uses an alias whereas the first doesn't.
What's the point you might ask? There are several advantages to using aliases:


- Aliases eliminate useless repetitions. If, while scripting, you often
call a series of functions, instead of mindlessly cut and pasting them
over and over, you could make an alias with them and invoke that
instead.

- They make your scripts easier to read and a LOT more comprehensive.
Someone who doesn't know how to script at all would know the second
script in the previous example buys a Desert Eagle.

- They are necessary to create your own +functions and multistate
functions (e.g.: ON/OFF functions).

- They generally make your life easier.


There are 2 types of aliases: normal aliases and +aliases. They work the
same way functions do.




-------------------------------------------------------------------------------
V. SCRIPTING
-------------------------------------------------------------------------------


The last two sections have shown you how to bind and make aliases, now
it's time to show you how to properly use these tools to make more complex
scripts than simple binds.



WHICH TO CHOOSE? A +ALIAS OR A NORMAL ALIAS?
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

First, to explain things a bit more in detail than in the Basics section,
there are 2 states a key can have: pressed and depressed. The +function is
associated with the pressed state of the key while the -function is associated
with its depressed state. Both + and - functions aren't continuous, they are
only executed once. Normal functions are essentially +functions without a
- counterpart. They don't necessarily have to be bound to keys, they can be
used within aliases or invoked directly from the console.

With that in mind, normal aliases should be used for "one shot" scripts
such as buy scripts. Multi-state scripts such as ON/OFF scripts or scripts
that cycle through several options before looping back to the beginning
require chain aliasing (for the lack of a better term). Scripts modifying
existing functions or scripts you want to be press & hold require +aliases.
Of course, nothing prevents you from mixing them all together, but you
shouldn't do that until you're very comfortable with simpler scripts. You'll
have to be careful when mixing normal aliases, +aliases: if you're using
+functions/+aliases inside a normal alias, you'll have to remember that you
must invoke the -function counterpart somewhere.

By the way, don't be too fancy with alias names. Use letters, numbers and
undercases ( _ ) only.



CHAIN ALIASING
¯¯¯¯¯¯¯¯¯¯¯¯¯¯

Chain aliasing is simply making a bunch of aliases, each refering to the
next one in the order you want them to cycle. For example:


alias "say_stuff" "text1"
alias "text1" "say A; alias say_stuff text2"
alias "text2" "say B; alias say_stuff text3"
alias "text3" "say C; alias say_stuff text1"
bind "X" "say_stuff"


would make the X key say A on the first press. B on the second. C on the third.
A on the fourth and so on.

How does this work? First, the X key calls say_stuff. The say_stuff alias
then points to the text1 alias that says "A" and then overrides say_stuff with
a new alias of the same name, but this one points to text2 instead. And so on.
If you want the aliases to cycle endlessly, make the last one point to the
first one. This is how you make multistate and ON/OFF scripts.



ENABLING MULTI-FUNCTION KEYS & MAKING YOUR OWN MENUS
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

They are other ways than chain aliasing to give keys multi-functions. You
can either enable SHIFT+KEY, CTRL+KEY and ALT+KEY support or make your own
menus. But first, SHIFT+KEY support.


SHIFT+KEY isn't really supported by the Half-Life engine, but you can
pseudo-enable it by yourself. The concept here isn't very complicated: when
the SHIFT key is pressed, you bind all the keys to their new functions, and
when the key is depressed, you rebind all the keys to their default ones.
Simple enough? Here's a template as an example:


bind "SHIFT" "+shift_on"
alias "+shift_on" "secondary_x; secondary_y; secondary_z"
alias "-shift_on" "primary_x; primary_y; primary_z"

alias "primary_x" "bind x ..."
alias "primary_y" "bind y ..."
alias "primary_z" "bind z ..."
alias "secondary_x" "bind x ..."
alias "secondary_y" "bind y ..."
alias "secondary_z" "bind z ..."


This would enable SHIFT support for the X, Y and Z keys. Replace ... with
anything you want the keys to do. Note that while this work rather well, you
might experience some problems if you bind/rebind too many keys at once. By
the way, you don't really have to use SHIFT/CTRL/ALT, you can use any other
key if you wish.


Making your own menus is practically the same thing with a little
difference: printing text on the screen. Indeed, it might be helpful if you
forgot what your menu does.

To print text, you need to use the 'echo' command. However, the text will
only be displayed in your console unless you turn developer mode on
(developer 1). Here's a modified version of the previous example to turn it
into a menu:


bind "X" "+menu_on"
alias "+menu_on" "bind1; bind2; bind3; bind4; print_choices"
alias "-menu_on" "rebind1; rebind2; rebind3; rebind4"

alias "print_choices" "d_on; print4; print3; print2; print1; d_off"
alias "print4" "echo 4th_choice_text_here"
alias "print3" "echo 3rd_choice_text_here"
alias "print2" "echo 2nd_choice_text_here"
alias "print1" "echo 1st_choice_text_here"
alias "d_on" "developer 1"
alias "d_off" "developer 0"

alias "bind1" "bind 1 choice1"
alias "bind2" "bind 2 choice2"
alias "bind3" "bind 3 choice3"
alias "bind4" "bind 4 choice4"
alias "rebind1" "bind 1 slot1"
alias "rebind2" "bind 2 slot2"
alias "rebind3" "bind 3 slot3"
alias "rebind4" "bind 4 slot4"

alias choice1 "..."
alias choice2 "..."
alias choice3 "..."
alias choice4 "..."


Lots of aliases, I know. print4, print3, print2, print1, d_on and d_off aren't
really necessary, it was just to make the print_choices alias less lengthy so
it could fit in the format of this FAQ.

You could also turn the SHIFT & menu buttons into toggles if you want, but
I personally find the press & hold format more practical.


To be completed......








 
Комментарии:
Ваш комментарий сохранен!!!
The Captcha element applies the Captcha validation, which uses reCaptcha's anti-bot service to reduce spam submissions.

Weapon Fix FAQ
Engl. FAQ

17.Октябрь 2013
Buy Script FAQ
Engl. FAQ

18.Октябрь 2013
cs_siege map Strategy Guide
Engl. Leitfaden

17.Октябрь 2013
cs_militia map Strategy Guide
Engl. Leitfaden

15.Октябрь 2013
cs_assault map Strategy Guide
Engl. Leitfaden

18.Октябрь 2013
Strategy Guide
Engl. Leitfaden

17.Октябрь 2013
Engl. Leitfaden

17.Октябрь 2013
Deutsch-Patch für v1.6
Patch

16.Октябрь 2013
de_aztec Map Strategy Guide
Engl. Leitfaden

17.Октябрь 2013
Engl. FAQ

17.Октябрь 2013
ScoutzKnifez In-depth Guide
Engl. FAQ

17.Октябрь 2013
Zero Weapon Fix FAQ
Engl. FAQ

16.Октябрь 2013
Sniper's Handbook
Engl. Leitfaden

16.Октябрь 2013
De_Dust2 Strategy Guide
Engl. Leitfaden

17.Октябрь 2013
Real Weapons Faq
Engl. FAQ

16.Октябрь 2013
Leitfaden

17.Октябрь 2013
Engl. FAQ

18.Октябрь 2013
Easteregg

17.Октябрь 2013
Addon

17.Октябрь 2013
Specific Weapon Techinques
Engl. FAQ

17.Октябрь 2013
Vertigo Strategy Guide
Engl. FAQ

17.Октябрь 2013
Stealth Playing Guide
Engl. FAQ

17.Октябрь 2013
FAQ

17.Октябрь 2013
Engl. Lösung

17.Октябрь 2013
Bloodpatch

17.Октябрь 2013
Geldtrainer Teil 2 (nur für POD_BOTS v2.5; Achtung: 1.4 MB)
Trainer

17.Октябрь 2013
Geldtrainer Teil 1 (nur für POD_BOTS v2.5; Achtung: 1.6 MB)
Trainer

17.Октябрь 2013
Blutpatch

17.Октябрь 2013
Engl. FAQ

15.Октябрь 2013
Ausführlicher dt. Guide für CS im HTML-Format
Hinweise

17.Октябрь 2013
 
Популярное
04.Март 2019
30.Декабрь 2013
25.Сентябрь 2015
07.Июль 2015
07.Апрель 2014
24.Июль 2014
11.Июнь 2014
27.Май 2015
19.Февраль 2014