Scripts
Complete descriptions of the console commands and variables are available (in handy categorized lists and a complete alphabetical list for reference). Check out the Categories page for descriptions of the categories.
// Anything after a // on a line is a comment and will be ignored by the console. You don't need to type in the // or anything after it to use a variable or command, but it's a convenient way to add explanations/reminders in an autoexec.cfg or other .cfg file (see exec)
// The syntax to use (change) a variable is:
variable_name variable_value // typed into the console or.. variable_name variable_value // when used in an autoexec.cfg file |
// Commands are even easier to use, just type their name into the console or a line of an autoexec.cfg file. You can also bind a key to perform any command like this:
bind key command_name |
// While you're at it, you can create aliases, which are just other names by which you can refer to commands or sets of commands (separated by semicolons ;).
The syntax for creating an alias is:
alias alias_name "command1; command2; commandn" |
// Then the alias you made (alias_name in the example above) becomes a command, to which you can bind a key, as in:
bind RETURN alias_name |
// Here in lies the power of the console language. It lets you create scripts and complex commands that do just about anything you can think of with a single keypress. A simple example is the float alias, which will toggle a "float mode" that will keep you on the surface of water as long as it's active.
Here it is:
alias float_on "+moveup; echo Floating is ON; bind f float_off" alias float_off "-moveup; echo Floating is OFF; bind f float_on" bind f float_on |
// Here we see the purpose for the -command version of the movement commands (each +command has one, even though I don't list them on the Console Commands page). When used in an alias, the +command stays active until the corresponding -command is issued. This is different from when you bind +command to a key -- then the -command is automatically issued when you let off of the key. This example shows how to convert an 'only on while you hold the key down' (or "momentary") command to a toggle command -- in this case the "+moveup" command is converted. See Converting Command Types below for more info.
// You can get as complex as you want with aliases and binds. For example, this 'script' causes the n key to select between fast, medium, and slow network connection settings:
alias fast "rate 3000; echo FAST NET; bind n medium" alias medium "rate 2500; echo MED NET; bind n slow" alias slow "rate 2000; echo SLOW NET; bind n fast" bind n fast |
Converting Command Types
Momentary-to-Toggle
// // +commands like +attack are only active while the key bound to them is held down // if you want to make that key a toggle instead (hit once for on, again for off, etc) // alias starting_condition "+command ; bind x alternate_condition; [optional commands] " alias alternate_condition "-command ; bind x starting condition; [optional commands] " bind x starting_condition |
Toggle-to-Momentary
// // commands like 'cmd help' (shows scores in multiplayer) turn 'on' when you // activate them once and then turn 'off' when you activate them again (and so on). // if you want to have such commands only active while you hold the key: // alias +score "cmd help" alias -score "cmd help" bind F1 "+score" // // here I've created my own +command "+score" with aliasing. // Now when I press F1, +score is executed. When I release F1, // -score is executed (toggling it back off) |
Cycling Through Multiple Options
// it's sometimes nice to have a single key select between multiple choices // to avoid adding three new key binds for three levels of zoom, for example // alias zoom1 "fov 90; sensitivity 10; bind z zoom2" alias zoom2 "fov 60; sensitivity 7; bind z zoom3" alias zoom3 "fov 30; sensitivity 4; bind z zoom1" bind z zoom2 // first press of z will get zoom2, then 3, 1, 2, 3, etc. // // fov XX sets the zoom level (field-of-view size) and sensitivity sets the mouse // sensitivity to go along with it (reduced sensitivity at higher zooms helps control) |
Ready-made Scripts and Aliases
Each of these scripts is composed of lines beginning with 'alias' or 'bind'. If your browser window is not wide enough, you may see lines wrap around -- make sure each 'alias' or 'bind' line is on a single line to make them work. You should change the key to which each script is bound (change the keyname in 'bind key aliasname'). You can put some or all of these scripts in a file called Kingpin\main\anything.cfg, then execute the script from the console with 'exec anything.cfg'. If you want the script to by automatically active all the time, put it in the text file Kingpin/main/autoexec.cfg.
Sniper Zoom (great on the HMG)
alias zoom "s1a;s1b" alias unzoom "s2a;s2b" alias s1a fov "30" alias s2a fov "90" alias s1b bind key "unzoom" alias s2b bind key "zoom" |
Mouse-Wheel Sniper Zoom
This handy little alias lets you zoom in and out with the mousewheel and the third mouse button (or the key you choose) returns you to normal mode [submitted by Double Barrel].
bind mouse3 "fov 90" bind "mwheel_u" "wheelzoomu" bind "mwheel_d" "wheelzoomd" alias "wheelzoomd" "fov 45;wait;bind mwheel_d wheelzoomd2;wait;bind mwheel_u wheelzoomu3" alias "wheelzoomd2" "fov 60;wait;bind mwheel_d wheelzoomd3;wait;bind mwheel_u wheelzoomu2" alias "wheelzoomd3" "fov 90;wait;bind mwheel_u wheelzoomu" alias "wheelzoomu" "fov 60;wait;bind mwheel_u wheelzoomu2;wait;bind mwheel_d wheelzoomd3" alias "wheelzoomu2" "fov 45;wait;bind mwheel_u wheelzoomu3;wait;bind mwheel_d wheelzoomd2" alias "wheelzoomu3" "fov 30;wait;bind mwheel_d wheelzoomd" |
Get Loot From Corpses With One Keypress
bind key +getloot alias +getloot "+movedown; +activate" alias -getloot "-movedown; -activate" |
Toggle Weapon-Holding Hand
bind key shand1 alias shand0 "alias shand hand1;hand 0" alias shand1 "alias shand hand0;hand 1" shand0 |
Double Quick-Saves
F8 quicksaves
F9 qickloads last quicksave
F10 quickloads quicksave BEFORE last quicksave
bind F8 qsv bind F9 qld_a bind F10 qld_b alias qsv qsv1 alias qsv1 "alias qsv qsv2;alias qld_a qld1;alias qld_b qld2;echo Quicksaving...;wait;save q1" alias qsv2 "alias qsv qsv1;alias qld_a qld2;alias qld_b qld1;echo Quicksaving...;wait;save q2" alias qld_a qld1 alias qld_b qld2 alias qld1 "echo Quickloading...;wait;load q1" alias qld2 "echo Quickloading...;wait;load q2" |