Go Back   Gaming Gutter > Online Gaming > Other Games > Steam Games > Counter-Strike


Counter-Strike - All Counter-Strike discussion must be contained in here.

» Site Navigation
» Home
» FAQ
» Log in
User Name:

Password:

Not a member yet?
Register Now!
» Advertisement
» Recent Threads
Go to first new post Anyone here play RO?
11-12-2008 07:56 PM
Last post by Snakebite
Today 01:58 AM
21 Replies, 144 Views
Go to first new post Lil Wayne
10-21-2008 09:33 PM
Last post by Snakebite
Today 01:45 AM
85 Replies, 755 Views
Go to first new post P2P Skills and...
Today 12:35 AM
Last post by smokey
Today 01:24 AM
2 Replies, 14 Views
Go to first new post RO stuff thread.
Today 01:17 AM
Last post by Snakebite
Today 01:17 AM
0 Replies, 2 Views
Go to first new post What movie have you just...
11-29-2008 10:34 AM
by Kospor
Last post by Calliss
Today 01:15 AM
21 Replies, 140 Views
Reply
 
LinkBack Thread Tools Display Modes

 Scripting CSS!
Old 07-02-2007, 09:52 PM   #1 (permalink)
Underground

Male wesleyplet is offline
 
wesleyplet's Avatar
 
Join Date: Dec 2006
Location: Los Angeles
Age: 15
Posts: 103
GPoints: 225
iTrader: 0 / 0%
wesleyplet Is gaining popularity
Rep Power: 7
Scripting CSS!

Learn To Script For Counter-Strike: Source

This section will cover the basics for scripting in Counter-Strike Source. Many of the previously existing commands and rules that apply to scripting in Counter-Strike are still applicable in Source, but some are not. So I will try to only cover the changes that separate Source from other versions of Counter-Strike.
The Autoexec

Yes, this file was used in previous versions of CS, but was replaced by the userconfig.cfg in recent versions of CS. So I will start the basics off with information about this file. The autoexec.cfg file is a file that is executed during the loading of the game and usually follows the config.cfg file. What this does is actually overwrite settings that were previously set in the config.cfg file. Sometimes the game resets your config.cfg back to default settings, and the only thing saving your settings is your trusty userconfig file. For more information about creating an autoexec.cfg file, go to our tutorial here.

Now even though the autoexec is automatically executed by the game, you still have to actually create the file. You can either copy and rename your config.cfg into it, or make one from scratch with a Text Editor like Windows Notepad. Once you have one make sure it is in the proper directory; for Source it is something like this:

C:\Program Files\Valve\Steam\SteamApps\yourusername\counter-strike source\cstrike\cfg

Just make sure you place your autoexec.cfg in the same directory as the config.cfg.

Once you have your autoexec.cfg created and in the proper directory, you will want to add the settings and binds that you want to retain. You can either cut and paste these from your config.cfg file or type them in manually. Now make sure you save your file, and if using a Text Editor, make sure you use a .cfg extension and not the standard .txt extension. (Note - This is one of the most common mistakes when editing these files).

After that you are basically ready to go. Another good thing to do is to include an echo in your autoexec.cfg so that you can ensure that it properly loads. Add something like this to your file and resave:

echo
echo Autoexec loaded . . . . .
echo
If you open the console once you start the game, you should see "Autoexec loaded . . . . ." displayed. If you don't see that, your file did not load. You can manually load the file anytime by typing "exec autoexec.cfg" in the console.
The Placement

The next important factor with scripting in CS:Source is the placement of your scripting files. I just want to reiterate that your files need to be in the proper directory or they will not work. Here again are some sample paths for CS:Source:

This is the default (home) directory for scripts. All your user created files should go in this directory or sub-directory:

C:\Program Files\Valve\Steam\SteamApps\username@email.com\cou nter-strike source\cstrike\cfg
Now you will probably notice a directory called scripts. The only thing that should go in there is a kb_act.lst file for customizing your Keyboard tab.

C:\Program Files\Valve\Steam\SteamApps\yourusername\counter-strike source\cstrike\scripts

I like placing my script files in a sub-directory of the cfg directory to keep everything organized, similar to my AutoScript. My script creates it's own directory called autoscript with most of the script-unique files in there. So if I was trying to exec those files I would need to include the full path like this example of executing a file called "scripts":

exec autoscript/scripts.cfg
Buying Weapons

CS:Source allows players to directly bind buy commands with the following procedures using the "buy" command and the item. Here is the usage, an example, and list of commands:

1. usage: buy [item]

2. Here are some examples:

a. To buy an AK47, simply type in the console: buy ak47

b. To buy a combination you can:

Make an alias:
alias m4combo "buy m4a1; buy vesthelm; buy primammo"
bind "q" "m4combo"

or direct bind:

bind z "buy m4a1; buy vesthelm; buy primammo"

3. Here is a list of weapon and equipment commands that work with the buy command, notice how some are different from previous versions of CS:

galil - IDF Defender
ak47 - CV-47
scout - Schmidt Scout
sg552 - Krieg 552
awp - Magnum Sniper Rifle
g3sg1 - D3/AU1
famas - Clarion 5.56
m4a1 - Maverick M4A1 Carbine
aug - Bullpup
sg550 - Krieg 550 Commando
glock - 9x19mm Sidearm
usp - KM .45 Tactical
p228 - 228 Compact
deagle - Night Hawk .50C
elite - .40 Dual Elites
fiveseven - ES Five-Seven
m3 - Leone 12 Gauge Super
xm1014 - Leone YG1265 Auto Shotgun
mac10 - Ingram MAC-10
tmp - Schmidt Machine Pistol
mp5navy - KM Sub-Machine Gun
ump45 - KM UMP45
p90 - ES C90
m249 - M249
primammo - Primary Ammo
secammo - Secondary Ammo
vest - Kevlar
vesthelm - Kevlar+Helmet
flashbang - Flashbang
hegrenade &nbsp- HE Grenade
smokegrenade - Smoke Grenade
nvgs - Nightvision
defuser - Defusal Kit

* Note - The "buyammo1" and "buyammo2" commands are available to buy one clip of ammo for your primary and secondary weapons respectively.

The Use Command

You now have to to add the command "use" to the weapon name to instantly call that weapon for use.

usage: use [weapon_xxxx] (xxxx=weapon or item from list below)

2. Here are some examples:

a. To select an M4 directly, simply type in the console:

use weapon_m4a1

b. To make a direct bind:

bind c "use weapon_m4a1"

c. To make a "Quick Weapon Alias":

// Quick Pistol Alias //

alias qpist "use weapon_deagle; use weapon_usp; use weapon_glock; use weapon_p228; use weapon_elite; use weapon_fiveseven"

bind z "qpist"

3. Weapon Listing

weapon_knife
weapon_deagle
weapon_usp
weapon_glock
weapon_p228
weapon_elite
weapon_fiveseven
weapon_ak47
weapon_aug
weapon_g3sg1
weapon_m249
weapon_m4a1
weapon_m3
weapon_mac10
weapon_mp5navy
weapon_p90
weapon_scout
weapon_sg552
weapon_sg550
weapon_ump45
weapon_tmp
weapon_xm1014
weapon_awp
weapon_galil
weapon_famas
weapon_hegrenade
weapon_flashbang
weapon_smokegrenade
weapon_c4
Radio Aliases

The direct bind radio aliases are not in CS:Source, so you have to do it the "old school" way to make your own direct binds. Now remember, when using these types of aliases, you have to hold the key down a little longer so the onscreen menu will close. Here is a quick example:

// Roger/Affirmative
alias +roger "rd3; w2; ms1"
alias -roger "close"
alias rd3 "radio3"
alias ms1 "menuselect 1"
Incrementvar Command

This new command in CS:Source allows players to create single aliases or binds that can cycle thru a minimum and maximum value. This command streamlines the way in which we used to do long cycle scripts that contained values.

Usage: incrementvar varName minValue maxValue delta

bind F1 "incrementvar cl_crosshaircolor 0 4 1"

**** OLD WAY ****
alias crsclr "tg_clr"
alias tg_clr "cl_crosshaircolor 1; alias crsclr tg_clr1"
alias tg_clr1 "cl_crosshaircolor 2; alias crsclr tg_clr2"
alias tg_clr2 "cl_crosshaircolor 3; alias crsclr tg_clr3"
alias tg_clr3 "cl_crosshaircolor 4; alias crsclr tg_clr4"
alias tg_clr4 "cl_crosshaircolor 0; alias crsclr tg_clr"
bind m "tg_clr"

**** NEW WAY ****
//As a bind
bind m "incrementvar cl_crosshaircolor 0 4 1"

//As an alias
alias tg_clr "incrementvar cl_crosshaircolor 0 4 1"
bind m "tg_clr"

*The only limitation is that you can only go up in value or down. You cannot do random changes so if you want other variations, you will have to use the older method.
Bind Toggle Command

The BindToggle command is new command that allows you to create "bind toggles" for commands that are normally on and off, or 0 and 1. cl_showfps is a good example. To turn cl_showfps on, you use cl_showfps 1, which will show your current fps in the upper right of your screen. Cl_showfps 0 turns it off. Below are the examples of how it used to be done and how you can do it now.

**** OLD WAY ****
alias fps "fpson"
alias fpson "cl_showfps 1; alias fps fpsoff"
alias fpsoff "cl_showfps 0; alias fps fpson"
bind "m" "fps"

**** NEW WAY ****
BindToggle m cl_showfps

Preformance Commands

These settings are directly related to system performance, visual quality, and realism. By tweaking these settings you get the desired balance between performance and visual quality. All these settings will also vary greatly depending on the system you are running.

cl_detaildist [0-9999] - Sets the distance at which items are detailed at
(Recommendation - Leave it at the default value or set this between 1200-1800 until you get the best performance with the best quality.)

cl_detailfade [0-9999] - Sets the distance at which the deatil of items will fade
(Recommendation - Leave it at the default value or set this between 200-600 until you get the best performance with the best quality.)

cl_show_bloodsprays [0/1] - Shows blood sprays - May increase FPS if off, but very minimal.
(Recommendation - Leave it on "1")

cl_show_splashes [0/1] - Shows splashes in water - May increase FPS if off.
(Recommendation - Leave it on "1" for realism, turn it off "0" for a minimal performance increase near water)

cl_showfps [0/1/2] - Draw fps meter at top of screen (0 = Off, 1 = On, 2 = smooth fps)
(Recommendation - Use "cl_showfps 1" instead of net_graph if you are only trying to view your fps. If you want more network information, then use net_graph.)

cl_smooth [0/1] - Turns Smooth view/eye origin after prediction errors on and off (0 and 1)
(Recommendation - This one you will have to test. If your game is jerky, this is probably on "1". Try playing with this set to "0" and see how your accuracy is changed. If the jerkiness if gone and you have no accuracy problems, leave it set to "0". Just don't blame this setting if you are a noob!)

cl_smoothtime [0-2.0] - Smooth client's view after prediction error over this many seconds (0.01 - 2.0). This command is only relevant if cl_smooth is set to "1".
(Recommendation - If you have cl_smooth on "1", try setting this to 0.01 first and work your way up. I use somewhere between 0.01 and 0.03 when I have cl_smooth on.)

fog_enable [0/1] - Enable/Disable the viewing of fog. When fog_enable is set to "1", you will see visible fog if it is on the map. By turning it off you will gain a minimal amount of fps in maps that have fog.
(Recommendation - Leave it on "1" for realism, turn it off "0" for a minimal performance increase)

fps_max [001-999] - Sets the maximum limit for your frame rate.
(Recommendation - There is no reason to set this higher than the refresh rate of your monitor. Determine what the Hz are for the resolution you are playing at, and leave the fps_max set there. I have mine at fps_max 85 for 85Hz-1024x768. By doing this you will reduce tearing and jerky video.)

mat_antialias [0/1] - This is your antialias setting. You can change this manually or in the Options > Video > Advanced menu.
(Recommendation - Leave it at the default value)

mat_bloom [0/1] - Bloom lighting effect. It is visible on textures and props and gives the objects a more realistic appearance.
(Recommendation - I did not see any performance gain when running a demo with this value on and off, so I would recommend leaving this on "1".)

mat_bumpmap [0/1] - Bumpmap Setting. This has a 5-10% FPS hit if turned on "1". There is a noticeable difference in the textures when this is turned off, but when I was playing full speed, I didn't really notice it.
(Recommendation - Set this to "0" to gain 5-10% performance increase)

mat_clipz [0/1] - This is a video optimization that only draws what is visible on the client's screen, which yields a performance gain. If you have video problems when this is on, your card may not support this feature, and you will have to set it to "0".
(Recommendation - Leave it at the default value)

mat_compressedtextures [0/1] - Enable/Disable compressed textures. If you turn this off "0", you will get minimal quality increase with a huge performance hit of 10-15%. When this is on, the system uses compressed textures, which is easier to process. Kind of like the size of jpeg and a bmp picture file. They look the same, but the jpg is smaller with better compression.
(Recommendation - Leave this set to "1" On)

mat_dxlevel [50/60/70/80/81/90] - The DirectX Level, Default is optimal, but you can adjust manually here. A good idea is to switch your dxlevel to another level and then back to your original value, then reset your Video settings and restart your game. For example, you have DX9, you then switch your DX to mat_dxlevel 81, then you switch it back to mat_dxlevel 90. After that, you go into the game settings and re-select your Video settings, then restart your game. Dropping this value may increase your peformance, but it will reduce the overall picture quality.
(Recommendation - Leave it at the default value)

mat_fastnobump [0/1] - This setting only seemed to have an effect if mat_bumpmap was on. When on, this setting will reduce the quality of some textures, while improving performance.
(Recommendation - Leave it at the default value, or turn off "0")

mat_fastspecular [0/1] - Enable/Disable specularity for visual testing. This setting only seemed to have an effect if mat_specular was on. If you turn this off "0" when mat_specular is on, you will see a small performance increase.
(Recommendation - Leave it at the default value or turn on "1")

mat_filtertextures [0/1] - Enable/Disable filtered textures. When this value is turned off "0", you will get unfiltered "grainy" textures with a performance gain.
(Recommendation - Leave it at the default value or turn on "1")

mat_forceansio [0/1] - Ansio Setting. You can change this manually or in the Options > Video > Advanced menu.
(Recommendation - Leave it at the default value)

mat_mipmaptextures [0/1] - Enable/Disable mipmaptextures. This command details with the sharpness of the textures. If you turn it off you will get degraded textures with a slight performance increase. On average, I went from 110 to 111 FPS when this was turned off, which equates to less than 1%.
(Recommendation - Leave it at the default value or turn on "1")

mat_monitorgamma [0-9.9] - Adjusts monitor gamma (typically 2.2 for CRT and 1.7 for LCD).
(Recommendation - This is definitely a personal preference. I use 2.0 for my CRT.)

mat_specular [0/1] - Enable/Disable specularity for perf testing. This has a 5% FPS hit if turned on "1". I didn't notice that much of a quality difference when this was turned off.
(Recommendation - Set this to "0" to gain a 5% performance increase)

mat_vsync [0/1] - Force sync to vertical retrace.
(Recommendation - Leave it at the default value and set your fps_max to your monitor's refresh rate)

mp_decals [0-9999] - Sets the maximum number of decals in multiplayer game. Decreasing this value will increase performance, but will decrease the amount of decals your client can retain in memory. Also, remember that blood sprays can help you recognize where players are hiding, etc; so leaving this set to the default value or even increasing it is also an option.
(Recommendation - Leave it at the default value or change based on need "performance = lower")

r_decals [0-9999] - Sets the maximum number of decals. Decreasing this value will increase performance, but will decrease the amount of decals your client can retain in memory. Also, remember that blood sprays can help you recognize where players are hiding, etc; so leaving this set to the default value or even increasing it is also an option.
(Recommendation - Leave it at the default value or change based on need "performance = lower")

r_dynamic [0/1] - Enable/Disable dynamic lighting. When this is turned off you can gain some performance with only a slight decrease in visual quality.
(Recommendation - Leave it at the default value or change based on need "0" for performance, "1" for quality)

r_propsmaxdist [0-9999] - Maximum visible distance of prop. Decrease this value from default to increase performance. If reduce this too much, props will just pop up on your screen, so the safe values are from about 600 - 1800, with 1200 being optimal.
(Recommendation - Leave it at the default value or change based on need "performance = lower")

r_rainalpha [0-9999] - Changes rain alpha values (0=Off, higher value makes darker rain)
(Recommendation - Leave it at the default value or lower to make rain lighter. Do not raise value.)

r_RainSimulate [0/1] - Enable/disable rain simulation (0=Off, 1=On)
(Recommendation - Personal preference. Turn this off "0" if you want better visibility, leave on for realism. If you want the best of both worlds, adjust the r_rainalpha so that you have rain with better visibility.)

r_shadows [0/1] - Enable/Disable shadows
(Recommendation - Leave it at the default value)

r_WaterDrawReflection [0/1] - Enable/Disable water reflections. Turning this off will give you a performance gain but will make water look unrealistic and may even give you some video rendering problems on water textures.
(Recommendation - Leave it at the default value)

r_WaterDrawRefraction [0/1] - Enable/Disable water refractions. Turning this off will give you a performance gain but will make water look unrealistic and may even give you some video rendering problems on water textures.
(Recommendation - Leave it at the default value)

differences - Show all convars which are not at their default values
(Recommendation - Use this to check what values you have changed from default.)

You might be saying "Wow, that is alot of commands, but which ones are most important". So here are the commands that I feel are most important in regards to performance tweaking:

cl_smooth
fps_max
mat_bumpmap
mat_compressedtextures
mat_dxlevel
mat_specular
*Note - I will be adding pre-made performance configc for "high performance", "medium performance/quality", and "high quality" in the next part of my CS:Source Scripting Basics.
Network Settings

rate [0-99999] - Sets the max bytes/sec the host can receive data (Download). Now I have read tons of articles on this value over the years and each one basically comes up with a different answer on what this value should be. So I went onto a server and tested different values to see what worked best for me. I used values of 1000, 5000, 10000, 15000, 20000, and 25000, and did not notice any major differences in my ping, loss, or choke. Now the server I was on could have had a max rate set for clients, but I would have thought the 1000 would have been too low, but it wasn't.
(Recommendation - All I can say is try different values until you feel like you have the best connection possible. Most articles say between 10000 - 20000 for a cable internet connection.)

cl_rate [0-99999] - Sets the max bytes/sec the host can send data (Upload). Once again, I have read tons of articles on this value over the years and each one basically comes up with a different answer on what this value should be. So I went onto a server and tested different values to see what worked best for me. I used values of 1000, 2500, 5000, 75000, 10000, and 20000, and did not notice any major differences in my ping, loss, or choke. Now once again, the server I was on could have had a max cl_rate set for clients, but I would have thought the lowest value of 1000 would have been too low, but it wasn't.
(Recommendation - Try different values until you feel like you have the best connection possible. Most articles say between 7500 - 10000 for a cable internet connection.)

cl_updaterate [0-999] - Number of packets per second of updates you are requesting from the server (Download). This is another one of those mystifying values that everyone has a theory on, but each theory is a little different. This command is the number of packets per second that is requested from the server. Now the server can put a cap on this value, and the last time I checked the default was "60". So you can play around with this setting, but anything over 60 will probably not show any improvement.
(Recommendation - Try different values until you feel like you have the best connection possible. Most articles say between 50 - 100 for a cable internet connection. I use 85, which works fine for a server capped at 60.)

cl_cmdrate [0-999] - Max number of command packets sent to server per second (Upload). This should be in proportion to your cl_updaterate. Normally your download is 1/4th to 1/8th your upload, but once again you will read numerous articles that show these 2 values either the same or very close.
(Recommendation - Try different values until you feel like you have the best connection possible. Most articles say between 30 - 100 for a cable internet connection. I use 45, which works fine for me.)

cl_cmdbackup [0-999] - For each command packet, how many additional history commands are sent (helps in case of packet loss). By increasing this value you will also increase your ping, but you will send more accurate data to the server, which allows for the server to send out your information more accuately.
(Recommendation - Try different values until you feel like you have the best connection possible. Most articles say between 1 - 500 for a cable internet connection. I use 5 and haven't seen much of a difference between 5 and 50.)

cl_interp [0-0.1]- Enable/Disable whether you will interpolate object positions starting this many seconds in past
This is a valuable setting if you are having stuttering issues with cl_smooth off. This value is supposed to be in relation to your ping. So if you have a ping of 100, then your cl_interp should be 0.1 and a ping of 50 should have an cl_interp of 0.05.
(Recommendation - Leave this at the default value unless you are having hitbox issues, then try to align this setting with your ping)

cl_interpolate [0/1] - Interpolate entities on the client. Changing this setting will give you somewhat of a jumpy screen, so you may want to test this on "1" which should be the default, then "0".
(Recommendation - Leave it at the default value unless you are having extreme hitbox issues.)

cl_lagcomp_errorcheck [0/1] - Player index of other player to check for position errors. When on, this will help with your shot accuracy by checking for position errors. This will only be useful if you can aim in the first place.
(Recommendation - Leave this at the default value or change this to "1")

net_channels - Shows net channel info, a great way to determine your optimal network settings

net_maxfragments - Max fragment bytes per packet. Mine is defaulted to 1280 bytes.
(Recommendation - Leave this value at the default value unless you are experiencing severe choke or bad pings)

Hope this helps, and by the way the tut wasn't made by me, but i just thought it would be helpful for a lot of people who play css. Have fun
Credits: Darkness
__________________
.:Favorite - Deception:.


.:Latest - Nirvana:.
  Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Powered by vBadvanced CMPS v3.0 RC2

All times are GMT -7. The time now is 02:07 AM.


vBulletin skin developed by: eXtremepixels
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The contents of this webpage are copyright © 2006-2008 GamingGutter.com. All Rights Reserved.

Page generated in 0.09950495 seconds (100.00% PHP - 0% MySQL) with 19 queries