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.)
Line 4: Line 4:
}}
}}
==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.
* resource/OptionsSubKeyboard.res
* resource/OptionsSubKeyboard.res
* resource/OptionsSubKeyboardAdvancedDlg.res
* resource/OptionsSubKeyboardAdvancedDlg.res
Line 10: Line 10:
[[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}}
[[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}}
==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. '''config_default.cfg''' should instead come from the '''source engine.gcf'''. The '''config_default.cfg''' from '''source engine.gcf''' looks like this:
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:
  // [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 40: Line 43:
  bind "6" "slot6"
  bind "6" "slot6"
  bind "7" "slot7"
  bind "7" "slot7"
  bind "MWHEELUP" "invprev"
  bind "MWHEELUP"         "invprev"
  bind "MWHEELDOWN" "invnext"
  bind "MWHEELDOWN" "invnext"
  bind "q" "lastinv"
  bind "q" "lastinv"
Line 53: Line 56:
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.
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''':
To create a header, use the following format in your kb_act.lst:
  "blank" "=========================="
  "blank" "=========================="
  "blank" "#Localized_String"
  "blank" "#Localized_String"
Line 59: Line 62:
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 engine.gcf''' looks like:
Here's what the kb_act.lst from '''Source SDK Base 2013 Singleplayer/hl2/scripts''' looks like:
  "blank" "=========================="
  "blank" "=========================="
  "blank" "#Valve_Movement_Title"
  "blank" "#Valve_Movement_Title"
  "blank" "=========================="
  "blank" "=========================="
  "+forward" "#Valve_Move_Forward"
  "+forward" "#Valve_Move_Forward"
  "+back" "#Valve_Move_Back"
  "+back" "#Valve_Move_Back"
  "+moveleft" "#Valve_Move_Left"
  "+moveleft" "#Valve_Move_Left"
  "+moveright" "#Valve_Move_Right"
  "+moveright" "#Valve_Move_Right"
  "+speed"             "#Valve_Sprint"
  "+speed"             "#Valve_Sprint"
  "+jump" "#Valve_Jump"
  "+jump" "#Valve_Jump"
  "+duck" "#Valve_Duck"
  "+duck" "#Valve_Duck"
  "blank" "=========================="
  "blank" "=========================="
  "blank" "#Valve_Combat_Title"
  "blank" "#Valve_Combat_Title"
  "blank" "=========================="
  "blank" "=========================="
  "+attack" "#Valve_Primary_Attack"
  "+attack" "#Valve_Primary_Attack"
  "+attack2" "#Valve_Secondary_Attack"
  "+attack2" "#Valve_Secondary_Attack"
Line 78: Line 81:
  "+use" "#Valve_Use_Items"
  "+use" "#Valve_Use_Items"
  "phys_swap" "#Valve_Gravity_Gun"
  "phys_swap" "#Valve_Gravity_Gun"
  "impulse 100" "#Valve_Flashlight"
  "impulse 100" "#Valve_Flashlight"
  "+zoom" "#Valve_Suit_Zoom"
  "+zoom" "#Valve_Suit_Zoom"
  "impulse 50" "#Valve_Commander_Mode"
  "impulse 50" "#Valve_Commander_Mode"
  "slot1" "#Valve_Weapon_Category_1"
  "slot1" "#Valve_Weapon_Category_1"
  "slot2" "#Valve_Weapon_Category_2"
  "slot2" "#Valve_Weapon_Category_2"
Line 90: Line 93:
  "invprev" "#Valve_Previous_Weapon"
  "invprev" "#Valve_Previous_Weapon"
  "lastinv" "#Valve_Last_Weapon_Used"
  "lastinv" "#Valve_Last_Weapon_Used"
  "blank" "=========================="
  "blank" "=========================="
  "blank" "#Valve_Miscellaneous_Title"
  "blank" "#Valve_Miscellaneous_Title"
  "blank" "=========================="
  "blank" "=========================="
  "incrementvar closecaption 0 1 1" "#Valve_CC_Toggle"
  "incrementvar closecaption 0 1 1" "#Valve_CC_Toggle"
  "jpeg" "#Valve_Take_Screen_Shot"
  "jpeg" "#Valve_Take_Screen_Shot"
  "save quick" "#Valve_Quick_Save"
  "save quick" "#Valve_Quick_Save"
  "load quick" "#Valve_Quick_Load"
  "load quick" "#Valve_Quick_Load"
  "pause" "#Valve_Pause_Game"
  "pause" "#Valve_Pause_Game"
  "quit" "#Valve_Quit_Game"
  "quit" "#Valve_Quit_Game"
  "blank" "=========================="
"toggleconsole" "#Valve_Console_Toggle"
  "blank" "#Valve_Miscellaneous_Keyboard_Keys_Title"
  "blank" "=========================="
  "blank" "=========================="
  "blank" "#Valve_Miscellaneous_Keyboard_Keys_Title"
  "+walk"             "#Valve_Walk"
  "blank" "=========================="
  "+walk"             "#Valve_Walk"
  "+left" "#Valve_Turn_Left"
  "+left" "#Valve_Turn_Left"
  "+right" "#Valve_Turn_Right"
  "+right" "#Valve_Turn_Right"

Revision as of 08:59, 3 May 2017

Template:Otherlang2

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 Source SDK Base 2013 Singleplayer/episodic/cfg 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"

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.