Customizing Options: Keyboard: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Updated the page to be more Source 2013 oriented.)
m (Nesciuse moved page Customizing Options: Keyboard/en to Customizing Options: Keyboard without leaving a redirect: Move en subpage to basepage)
 
(14 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{otherlang2
{{LanguageBar}}
|pl=Customizing_Options:_Keyboard:pl
 
|sv=Customizing_Options:_Keyboard:sv
 
}}
==Control Settings==
==Control Settings==
These control settings files can be altered to modify the Keyboard tab & its dialog.
These control settings files can be altered to modify the Keyboard tab & its dialog.
Line 8: Line 7:
* resource/OptionsSubKeyboardAdvancedDlg.res
* resource/OptionsSubKeyboardAdvancedDlg.res
==scripts/kb_def.lst==
==scripts/kb_def.lst==
[[Image:Obsolete.png|left]] This file is not used anymore; use [[#cfg/config_default.cfg|cfg/config_default.cfg]] to define a '''default keyboard layout'''.{{clr}}
[[File:Obsolete.png|left]] This file is not used anymore; use [[#cfg/config_default.cfg|cfg/config_default.cfg]] to define a '''default keyboard layout'''.{{clr}}
==cfg/config_default.cfg==
==cfg/config_default.cfg==
The config_default.cfg provided in a [[Source]] game doesn't have all of the archived [[ConVar]]s that config.cfg does, you don't need to put the [[ConVar]]s from config.cfg into config_default.cfg as you should only worry about binds.  
The config_default.cfg provided in a [[Source]] game doesn't have all of the archived [[ConVar]]s that config.cfg does, you don't need to put the [[ConVar]]s from config.cfg into config_default.cfg as you should only worry about binds.  




The config_default.cfg from '''Source SDK Base 2013 Singleplayer/episodic/cfg''' looks like this:
The config_default.cfg from '''Half-Life 2/hl2/cfg''' looks like this:
<syntaxhighlight lang="cfg">
  // [mailto:yahn@valvesoftware.com YWB] 10/10/03:   
  // [mailto:yahn@valvesoftware.com YWB] 10/10/03:   
  // If the user doesn't have a config.cfg when they run,
  // If the user doesn't have a config.cfg when they run,
Line 52: Line 52:
  bind "z" "+zoom"
  bind "z" "+zoom"
  bind "g" "phys_swap"
  bind "g" "phys_swap"
//bugbait switch
bind "x" "bug_swap"
// on Mac don't cause CTRL to be bound as it doesn't play well with mouse wheel
// move duck and walk across one key as we had the command key to play with
bind_mac "ALT" "+duck"
bind_mac "LWIN" "+walk"
unbind_mac "CTRL"
// F9 is Expose by default so move it to F8 on Mac
bind_mac "F8" "load quick"
unbind_mac "F9"
</syntaxhighlight>


==scripts/kb_act.lst==
==scripts/kb_act.lst==
Line 57: Line 69:


To create a header, use the following format in your kb_act.lst:
To create a header, use the following format in your kb_act.lst:
<pre>
  "blank" "=========================="
  "blank" "=========================="
  "blank" "#Localized_String"
  "blank" "#Localized_String"
  "blank" "=========================="
  "blank" "=========================="
</pre>
The tokenized string should be put in your mod's localized string files (i.e. valve_english.txt).
The tokenized string should be put in your mod's localized string files (i.e. valve_english.txt).


Here's what the kb_act.lst from '''Source SDK Base 2013 Singleplayer/hl2/scripts''' looks like:
Here's what the kb_act.lst from '''Source SDK Base 2013 Singleplayer/hl2/scripts''' looks like:
<pre>
  "blank" "=========================="
  "blank" "=========================="
  "blank" "#Valve_Movement_Title"
  "blank" "#Valve_Movement_Title"
Line 115: Line 130:
  "+strafe" "#Valve_Strafe_Modifier"
  "+strafe" "#Valve_Strafe_Modifier"
  "+klook" "#Valve_Keyboard_Look_Modifier"
  "+klook" "#Valve_Keyboard_Look_Modifier"
</pre>


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:
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:
Line 124: Line 140:


Keep this in mind when designing your custom keyboard commands.
Keep this in mind when designing your custom keyboard commands.
==See also==
*{{ent|bind}}, the console command used for assigning keys functions (also lists related commands).
[[category:Technical]]
[[category:Technical]]
[[Category:Modding]]
[[Category:Modding]]

Latest revision as of 06:05, 12 July 2024

English (en)Polski (pl)Русский (ru)Svenska (sv)Translate (Translate)


Control Settings

These control settings files can be altered to modify the Keyboard tab & its dialog.

  • resource/OptionsSubKeyboard.res
  • resource/OptionsSubKeyboardAdvancedDlg.res

scripts/kb_def.lst

Obsolete.png

This file is not used anymore; use cfg/config_default.cfg to define a default keyboard layout.

cfg/config_default.cfg

The config_default.cfg provided in a Source game doesn't have all of the archived ConVars that config.cfg does, you don't need to put the ConVars from config.cfg into config_default.cfg as you should only worry about binds.


The config_default.cfg from Half-Life 2/hl2/cfg looks like this:

 // [mailto:yahn@valvesoftware.com 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"
 //bugbait switch
 bind "x"			"bug_swap"
 
 // on Mac don't cause CTRL to be bound as it doesn't play well with mouse wheel
 // move duck and walk across one key as we had the command key to play with
 bind_mac "ALT"	"+duck"
 bind_mac "LWIN"	"+walk"
 unbind_mac "CTRL" 
 // F9 is Expose by default so move it to F8 on Mac
 bind_mac "F8"			"load quick"
 unbind_mac "F9"

scripts/kb_act.lst

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"					"#Localized_String"
 "blank"					"=========================="

The tokenized string should be put in your mod's localized string files (i.e. valve_english.txt).

Here's what the kb_act.lst from Source SDK Base 2013 Singleplayer/hl2/scripts 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"
 "toggleconsole"			"#Valve_Console_Toggle"
 "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.

See also

  • bind, the console command used for assigning keys functions (also lists related commands).