GameMenu

From Valve Developer Community
Jump to: navigation, search

GameMenu.res is a RES file that is located inside the resource/ folder of the game / mod. It is the file that controls the menu buttons that will appear in the in-game menu. Mods can use this for adding new command buttons to their main menu.

They are simply a text document saved with a .res extension inside the resource/ folder. Example syntax (from HL2):

"GameMenu"
{
	"1"
	{
		"label" "#GameUI_GameMenu_ResumeGame"
		"InGameOrder" "10"
		"OnlyInGame" "1"
	}
	"2"
	{
		"label" "#GameUI_GameMenu_Disconnect"
		"command" "Disconnect"
		"OnlyInGame" "1"
		"notsingle" "1"
	}
//	"3"	[$WIN32] // from portal
//	{
//		"label" "#GameUI_GameMenu_BonusMaps"
//		"command" "OpenBonusMapsDialog"
//		"InGameOrder" "50"
//		"notmulti" "1"
//	}
	"3"

	{
		"label" "#GameUI_GameMenu_PlayerList"
		"command" "OpenPlayerListDialog"
		"OnlyInGame" "1"
		"notsingle" "1"
	}
	"4"     //devider
	{
		"label" ""
		"command" ""
		"OnlyInGame" "1"
	}
	"5"
	{
		"label" "#GameUI_GameMenu_NewGame"
		"command" "OpenNewGameDialog"
		"notmulti" "1"  //nomulti will make this button not appear when in MP mode
	}
	"6"
	{
		"label" "#GameUI_GameMenu_LoadGame"
		"command" "OpenLoadGameDialog"
		"notmulti" "1"
	}
	"7"
	{
		"label" "#GameUI_GameMenu_SaveGame"
		"command" "OpenSaveGameDialog"
		"notmulti" "1"
		"OnlyInGame" "1"
	}
	"8"
	{
		"label" "#GameUI_GameMenu_Achievements"
		"command" "OpenAchievementsDialog"
		"InGameOrder" "70"
	}
//         "8" 
//	{
//		"label" "#GameUI_Controller"
//		"command" "OpenControllerDialog"
//		"InGameOrder" "80"
//		"ConsoleOnly" "1"
//	}
	"9"
	{
		"label" ""
		"command" ""
		"notmulti" "1"
	}
	"10"
	{
		"label" "#GameUI_GameMenu_FindServers"
		"command" "OpenServerBrowser"
		"notsingle" "1"
	}
	"11"
	{
		"label" "#GameUI_GameMenu_CreateServer"
		"command" "OpenCreateMultiplayerGameDialog"
		"notsingle" "1"
	}
	"12"
	{
		"label" "#GameUI_GameMenu_Friends"
		"command" "OpenFriendsDialog"
	}
//	"13"  // not needed
//	{
//		"name" "LoadDemo"
//		"label" "#GameUI_GameMenu_PlayDemo"
//		"command" "OpenLoadDemoDialog"
//	}
	"14"
	{
		"label" ""
		"command" ""
		"notsingle" "1"
	}
	"15"
	{
		"label" "#GameUI_GameMenu_Options"
		"command" "OpenOptionsDialog"
	}
	"16"
	{
		"label" "#GameUI_GameMenu_Quit"
		"command" "Quit"
	}
}

List of commands

This is the list of commands that can be assigned to a GameMenu button. You can try these in the console with gamemenucommand. Some of these only work on multiplayer mods, some command can't be issued in the main menu and some only works on the Xbox 360 platform. There are several undocumented commands and those are not shown here.

Command What it does Notes
OpenPlayerListDialog Players can mute other players here Non-functional on singleplayer branch
OpenNewGameDialog Shows the chapter selection window
OpenLoadGameDialog Shows the load game window X360 has a different dialog.
OpenSaveGameDialog Shows the save game window X360 has a different dialog.
OpenBonusMapsDialog Shows the "Bonus Maps" dialog
OpenOptionsDialog Shows the options dialog X360 has a different dialog.
OpenControllerDialog Shows controller settings Only works on console UI.
OpenBenchmarkDialog Opens the Lost Coast benchmark dialog
OpenServerBrowser Shows a list of game servers Also opens on singleplayer.
OpenFriendsDialog Shows a list of Steam friends Non-functional.
OpenLoadDemoDialog Does nothing (maybe it's supposed to show demoui)
OpenCreateMultiplayerGameDialog Shows the listen server creation dialog First page works on singleplayer.
OpenChangeGameDialog Non-functional, players can load other games/mods here (Leftover from GoldSrc?)
OpenLoadCommentaryDialog Shows a dialog with a list of commentaries This is for multiplayer games
OpenLoadSingleplayerCommentaryDialog Shows the new game dialog, but this one starts the game in commentary mode This is for singleplayer games
OpenMatchmakingBasePanel Unknown, maybe used for Team Fortress 2 On Source 2013 this opens an transparent panel covering the whole screen, effectively making the menu unusable
OpenAchievementsDialog Shows the achievements dialog Shows a message if the player is not using Steam or is logged off. On X360 the native dialog is shown.
Quit Shows the quit confirmation dialog
QuitNoConfirm Closes the game without confirmation
ResumeGame Hides the menu when in-game
Disconnect Disconnects from the game Shows a confirmation dialog on X360
DisconnectNoConfirm Disconnects from the game without confirmation Also closes all dialogs if the Matchmaking Base Panel is open
engine <concommand> Executes console command <concommand>
RestartWithNewLanguage Closes the game and makes it start in a new language next time. Only works on PC. Used when the spoken language is modified in the Audio options. Works by setting a string value called a "Relaunch URL" in regedit with value steam://run/<appid>/<language>. This makes Steam execute this URL after the current game exits. (doesn't work with mods)