Customizing Options: Keyboard: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Folder location, for newbs)
m (Noting "+" commands)
Line 106: Line 106:
  "+klook" "#Valve_Keyboard_Look_Modifier"
  "+klook" "#Valve_Keyboard_Look_Modifier"


As you can see, the format of adding a command to the list is very simple.
As you can see, the format of adding a command to the list is very simple. Note also that any commands with "+" create a "-" command when you lift the key. For example, creating the custom command "+camera" and binding it to "TAB". When you press TAB, check the console and you will see:
 
<pre>
Unknown command: +camera
Unknown command: -camera
</pre>
 
Keep this in mind when designing your custom keyboard commands.

Revision as of 08:06, 7 July 2005

Setting Up Your MOD's Default Keys

The default keyboard layout that appears in the keyboard options tab is generated by the commands containing bind in {your_mod}/cfg/config_default.cfg. This means kb_def.lst is NOT of any use to have.


The config_default.cfg doesn't have all of the archived cvars that config.cfg does. config_default.cfg should instead come from the source engine.gcf. The config_default.cfg from source engine.gcf looks like this:

// YWB 10/10/03:  
// If the user doesn't have a config.cfg when they run, this gets executed the first time they run the engine
// It doesn't execute if they have their own config.cfg saved out.
unbindall

bind "ESCAPE" 		"cancelselect"
bind "`" 		"toggleconsole"
bind "w"		"+forward"
bind "s"		"+back"
bind "a"		"+moveleft"
bind "d"		"+moveright"
bind "SPACE"		"+jump"
bind "CTRL"		"+duck"
bind "e"		"+use"
bind "c"		"impulse 50"
bind "r"		"+reload"
bind "ALT"		"+walk"
bind "SHIFT"		"+speed"
bind "MOUSE1"		"+attack"
bind "MOUSE2"		"+attack2"
bind "f"		"impulse 100"
bind "1"		"slot1"
bind "2"		"slot2"
bind "3"		"slot3"
bind "4"		"slot4"
bind "5"		"slot5"
bind "6"		"slot6"
bind "7"		"slot7"
bind "MWHEELUP"		"invprev"
bind "MWHEELDOWN"	"invnext"
bind "q"		"lastinv"
bind "F5"		"jpeg"
bind "F6"		"save quick"
bind "F9"		"load quick"
bind "PAUSE" 		"pause"
bind "z"		"+zoom"
bind "g"		"phys_swap"

Keyboard Commands

The keyboard commands refers to the list of commands and headers in scripts/kb_act.lst that appears in the keyboard tab of the options dialog.

To create a header, use the following format in your kb_act.lst:

"blank"			"=========================="
"blank"			"#Tokenized_String"
"blank"			"=========================="

The tokenized string should be put in your MODNAME_english.txt and any other languages you plan to make the mod available to.

Here's what the kb_act.lst from source engine.gcf looks like:

"blank"					"=========================="
"blank"					"#Valve_Movement_Title"
"blank"					"=========================="
"+forward"				"#Valve_Move_Forward"
"+back"					"#Valve_Move_Back"
"+moveleft"				"#Valve_Move_Left"
"+moveright"				"#Valve_Move_Right"
"+speed"             			"#Valve_Sprint"
"+jump"					"#Valve_Jump"
"+duck"					"#Valve_Duck"
"blank"					"=========================="
"blank"					"#Valve_Combat_Title"
"blank"					"=========================="
"+attack"				"#Valve_Primary_Attack"
"+attack2"				"#Valve_Secondary_Attack"
"+reload"				"#Valve_Reload_Weapon"
"+use"					"#Valve_Use_Items"
"phys_swap"				"#Valve_Gravity_Gun"
"impulse 100"				"#Valve_Flashlight"
"+zoom"					"#Valve_Suit_Zoom"
"impulse 50"				"#Valve_Commander_Mode"
"slot1"					"#Valve_Weapon_Category_1"
"slot2"					"#Valve_Weapon_Category_2"
"slot3" 				"#Valve_Weapon_Category_3"
"slot4"					"#Valve_Weapon_Category_4"
"slot5"					"#Valve_Weapon_Category_5"
"slot6"					"#Valve_Weapon_Category_6"
"invnext"				"#Valve_Next_Weapon"
"invprev"				"#Valve_Previous_Weapon"
"lastinv"				"#Valve_Last_Weapon_Used"
"blank"					"=========================="
"blank"					"#Valve_Miscellaneous_Title"
"blank"					"=========================="
"incrementvar closecaption 0 1 1"	"#Valve_CC_Toggle"
"jpeg"					"#Valve_Take_Screen_Shot"
"save quick"				"#Valve_Quick_Save"
"load quick"				"#Valve_Quick_Load"
"pause"					"#Valve_Pause_Game"
"quit"					"#Valve_Quit_Game"
"blank"					"=========================="
"blank"					"#Valve_Miscellaneous_Keyboard_Keys_Title"
"blank"					"=========================="
"+walk"           		  	"#Valve_Walk"
"+left"					"#Valve_Turn_Left"
"+right"				"#Valve_Turn_Right"
"+moveup"				"#Valve_Swim_Up"
"+movedown"				"#Valve_Swim_Down"
"+lookup"				"#Valve_Look_Up"
"+lookdown"				"#Valve_Look_Down"
"+strafe"				"#Valve_Strafe_Modifier"
"+klook"				"#Valve_Keyboard_Look_Modifier"

As you can see, the format of adding a command to the list is very simple. Note also that any commands with "+" create a "-" command when you lift the key. For example, creating the custom command "+camera" and binding it to "TAB". When you press TAB, check the console and you will see:

Unknown command: +camera
Unknown command: -camera

Keep this in mind when designing your custom keyboard commands.