GameMenu.res

From Valve Developer Community
(Redirected from GameMenu)
Jump to navigation Jump to search

🖿game or mod/resource/GameMenu.res 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.

Example

PlacementTip.pngExample: from Half-Life 2 Half-Life 2:

"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"
	}
}


Example #2

PlacementTip.pngExample: from Half-Life 2 Half-Life 2, 20th Anniversary Update / 🖿hl2_complete:

"GameMenu"
{
	"Main_1"
	{
		"label" "#GameUI_HalfLife2"
		"command" "SwitchExpansion hl2"
		"InGameOrder" "30"
		"notmulti" "1"
		"NotInGame" "1"
		"MenuCategory" "main"
		"Caps" "1"
	}
	"Main_2"
	{
		"label" "#GameUI_HalfLife2EpisodeOne"
		"command" "SwitchExpansion episodic"
		"InGameOrder" "40"
		"notmulti" "1"
		"NotInGame" "1"
		"MenuCategory" "main"
		"Caps" "1"
	}
	"Main_3"
	{
		"label" "#GameUI_HalfLife2EpisodeTwo"
		"command" "SwitchExpansion ep2"
		"InGameOrder" "50"
		"notmulti" "1"
		"NotInGame" "1"
		"MenuCategory" "main"
		"Caps" "1"
	}

	"Main_4_spc"
	{
		"label" ""
		"command" ""
		"InGameOrder" "65"
		"NotInGame" "1"
		"Caps" "1"
		"MenuCategory" "main"
	}

	"Main_4"
	{
		"label" "#GameUI_Extras"
		"command" "SwitchCategory extras"
		"InGameOrder" "70"
		"NotInGame" "1"
		"Caps" "1"
		"MenuCategory" "main"
	}
	"Main_5"
	{
		"label" "#GameUI_GameMenu_Options"
		"command" "OpenOptionsDialog"
		"InGameOrder" "90"
		"NotInGame" "1"
		"Caps" "1"
		"MenuCategory" "main"
	}
	"Main_6"
	{
		"label" "#GameUI_GameMenu_Quit"
		"command" "Quit"
		"InGameOrder" "100"
		"NotInGame" "1"
		"Caps" "1"
		"MenuCategory" "main"
	}

	"Pause_1"
	{
		"label" "#GameUI_GameMenu_ResumeGame"
		"command" "ResumeGame"
		"InGameOrder" "10"
		"OnlyInGame" "1"
		"Caps" "1"
	}
	"Pause_2"
	{
		"label" "#GameUI_GameMenu_LoadGame"
		"command" "OpenLoadGameDialog"
		"InGameOrder" "30"
		"notmulti" "1"
		"OnlyInGame" "1"
		"Caps" "1"
	}
	"Pause_3"
	{
		"label" "#GameUI_GameMenu_SaveGame"
		"command" "OpenSaveGameDialog"
		"InGameOrder" "40"
		"notmulti" "1"
		"OnlyInGame" "1"
		"Caps" "1"
	}
	"Pause_4"
	{
		"label" "#GameUI_GameMenu_Achievements"
		"command" "OpenAchievementsDialog"
		"InGameOrder" "70"
		"OnlyInGame" "1"
		"ExcludeFromMenuCategory" "lostcoast,workshop"
		"Caps" "1"
	}
	"Pause_5"
	{
		"label" "#GameUI_GameMenu_Options"
		"command" "OpenOptionsDialog"
		"InGameOrder" "90"
		"OnlyInGame" "1"
		"Caps" "1"
	}
	"Pause_6"
	{
		"label" "#GameUI_GameMenu_ReturnToMainMenu"
		"command" "OpenMainMenuDialog"
		"InGameOrder" "99"
		"OnlyInGame" "1"
		"Caps" "1"
	}
	"Pause_7"
	{
		"label" "#GameUI_GameMenu_Quit"
		"command" "Quit"
		"InGameOrder" "100"
		"OnlyInGame" "1"
		"Caps" "1"
	}

	"1_1"	
	{
		"label" "#GameUI_GameMenu_NewGame"
		"command" "OpenNewGameDialog hl2"
		"InGameOrder" "20"
		"notmulti" "1"
		"NotInGame" "1"
		"MenuCategory" "hl2"
		"Caps" "1"
	}
	"1_2"
	{
		"label" "#GameUI_GameMenu_LoadGame"
		"command" "OpenLoadGameDialog hl2"
		"InGameOrder" "30"
		"notmulti" "1"
		"MenuCategory" "hl2"
		"NotInGame" "1"
		"Caps" "1"
	}
	"1_3"
	{
		"label" "#GameUI_GameMenu_Achievements"
		"command" "OpenAchievementsDialog hl2"
		"InGameOrder" "70"
		"MenuCategory" "hl2"
		"NotInGame" "1"
		"Caps" "1"
	}
	"1_4_spc"
	{
		"label" ""
		"command" ""
		"InGameOrder" "85"
		"NotInGame" "1"
		"Caps" "1"
		"MenuCategory" "hl2"
	}
	"1_4"
	{
		"label" "#GameUI_GameMenu_Options"
		"command" "OpenOptionsDialog"
		"InGameOrder" "90"
		"MenuCategory" "hl2"
		"NotInGame" "1"
		"Caps" "1"
	}
	"1_5"
	{
		"label" "#GameUI_Back"
		"command" "SwitchCategory main"
		"InGameOrder" "100"
		"NotInGame" "1"
		"Caps" "1"
		"MenuCategory" "hl2"
	}
	
	"2_1"	
	{
		"label" "#GameUI_GameMenu_NewGame"
		"command" "OpenNewGameDialog episodic"
		"InGameOrder" "20"
		"notmulti" "1"
		"NotInGame" "1"
		"MenuCategory" "episodic"
		"Caps" "1"
	}
	"2_2"
	{
		"label" "#GameUI_GameMenu_LoadGame"
		"command" "OpenLoadGameDialog episodic"
		"InGameOrder" "30"
		"notmulti" "1"
		"MenuCategory" "episodic"
		"NotInGame" "1"
		"Caps" "1"
	}
	"2_3"
	{
		"label" "#GameUI_GameMenu_Achievements"
		"command" "OpenAchievementsDialog episodic"
		"InGameOrder" "70"
		"MenuCategory" "episodic"
		"NotInGame" "1"
		"Caps" "1"
	}
	"2_4_spc"
	{
		"label" ""
		"command" ""
		"InGameOrder" "85"
		"NotInGame" "1"
		"Caps" "1"
		"MenuCategory" "episodic"
	}
	"2_4"
	{
		"label" "#GameUI_GameMenu_Options"
		"command" "OpenOptionsDialog"
		"InGameOrder" "90"
		"MenuCategory" "episodic"
		"NotInGame" "1"
		"Caps" "1"
	}
	"2_5"
	{
		"label" "#GameUI_Back"
		"command" "SwitchCategory main"
		"InGameOrder" "100"
		"NotInGame" "1"
		"Caps" "1"
		"MenuCategory" "episodic"
	}
	
	"3_1"	
	{
		"label" "#GameUI_GameMenu_NewGame"
		"command" "OpenNewGameDialog ep2"
		"InGameOrder" "20"
		"notmulti" "1"
		"NotInGame" "1"
		"MenuCategory" "ep2"
		"Caps" "1"
	}
	"3_2"
	{
		"label" "#GameUI_GameMenu_LoadGame"
		"command" "OpenLoadGameDialog ep2"
		"InGameOrder" "30"
		"notmulti" "1"
		"MenuCategory" "ep2"
		"NotInGame" "1"
		"Caps" "1"
	}
	"3_3"
	{
		"label" "#GameUI_GameMenu_Achievements"
		"command" "OpenAchievementsDialog ep2"
		"InGameOrder" "70"
		"MenuCategory" "ep2"
		"NotInGame" "1"
		"Caps" "1"
	}
	"3_4_spc"
	{
		"label" ""
		"command" ""
		"InGameOrder" "85"
		"NotInGame" "1"
		"Caps" "1"
		"MenuCategory" "ep2"
	}
	"3_4"
	{
		"label" "#GameUI_GameMenu_Options"
		"command" "OpenOptionsDialog"
		"InGameOrder" "90"
		"MenuCategory" "ep2"
		"NotInGame" "1"
		"Caps" "1"
	}
	"3_5"
	{
		"label" "#GameUI_Back"
		"command" "SwitchCategory main"
		"InGameOrder" "100"
		"NotInGame" "1"
		"Caps" "1"
		"MenuCategory" "ep2"
	}
	

	"4_1"
	{
		"label"	"#GameUI_Worskhop_MenuName"
		"command" "openworkshopdialog"
		"InGameOrder" "72"
		"MenuCategory" "extras"
		"NotInGame" "1"
		"Caps" "1"
	}
	"4_2"
	{
		"label"	"#GameUI_HalfLife2LostCoast"
		"command" "SwitchExpansion lostcoast"
		"InGameOrder" "74"
		"Caps" "1"
		"MenuCategory" "extras"
		"NotInGame" "1"
		"Caps" "1"
	}
	
	"4_3_spc"
	{
		"label" ""
		"command" ""
		"InGameOrder" "65"
		"NotInGame" "1"
		"Caps" "1"
		"MenuCategory" "extras"
	}

	"4_3"
	{
		"label" "#GameUI_Back"
		"command" "SwitchCategory main"
		"InGameOrder" "100"
		"NotInGame" "1"
		"Caps" "1"
		"MenuCategory" "extras"
	}


	"5_1"
	{
		"label" "#GameUI_GameMenu_NewGame"
		"command" "OpenNewGameDialog lostcoast"
		"InGameOrder" "20"
		"notmulti" "1"
		"NotInGame" "1"
		"Caps" "1"
		"MenuCategory" "lostcoast"
	}
	"5_2"
	{
		"label" "#GameUI_GameMenu_LoadGame"
		"command" "OpenLoadGameDialog lostcoast"
		"InGameOrder" "30"
		"notmulti" "1"
		"NotInGame" "1"
		"Caps" "1"
		"MenuCategory" "lostcoast"
	}
	"5_3"
	{
		"label" "#GameUI_GameMenu_Options"
		"command" "OpenOptionsDialog"
		"InGameOrder" "90"
		"NotInGame" "1"
		"Caps" "1"
		"MenuCategory" "lostcoast"
	}
	"5_4"
	{
		"label" "#GameUI_ReturnToMainGame"
		"command" "SwitchExpansion hl2"
		"InGameOrder" "99"
		"NotInGame" "1"
		"Caps" "1"
		"MenuCategory" "lostcoast"
	}
	"5_5"
	{
		"label" "#GameUI_GameMenu_Quit"
		"command" "Quit"
		"InGameOrder" "100"
		"NotInGame" "1"
		"Caps" "1"
		"MenuCategory" "lostcoast"
	}
}	

File format

Broom icon.png
This article or section needs to be cleaned up to conform to a higher standard of quality because:
Add HTML span tags with id attribute to each parameter and command, to make linking easier.
For help, see the VDC Editing Help and Wikipedia cleanup process. Also, remember to check for any notes left by the tagger at this article's talk page.

Parameters

Parameter Purpose
name
label The display text of the button. If appended with a pound symbol, it will correspond to the corresponding key-value pair in gameui_<LANGUAGE>.txt.
command The command to run when the button is clicked, not to be confused with a console command (although console commands can be run using engine <command>). See Commands ↓ for a list.
notsingle If set to "1", will not display in singleplayer.
notmulti If set to "1", will not display in multiplayer.
notsteam If set to "1", will not display if game is launched with -steam.
InGameOrder
OnlyInGame If set to "1", will only display if the user is currently ingame.
ConsoleOnly If set to "1", will only display on consoles, such as the Xbox 360.
Caps (?)
NotInGame If set to "1", will not display while ingame. Opposite of "OnlyInGame"
MenuCategory λ Sets the category that your options will appear under. (If it is not set, any options lacking this param will appear on the "main" category and possibly any other category too.)
ExcludeFromMenuCategory Any categories listed for the option this param is listed under will not appear. For example, the achievements option the pause menu will not show while playing either a workshop campaign or Lost Coast, as they will not and do not, respectively, have them.

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; Sets controls to controller friendly inputs Only works on console UI.; Mainly used for the Android port for the Nvidia Shield line of devices, doesn't show controller settings - just changes the settings.
OpenBenchmarkDialog Opens the Lost Coast benchmark dialog
OpenServerBrowser Shows a list of game servers Also opens on singleplayer.
In Left 4 Dead engine branch games, which hides the gamemenucommand console command, has openserverbrowser console command.
OpenFriendsDialog Shows a list of Steam friends Deprecated and non-functional since Source 2006 update (in July 31, 2007).
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.
In other games except Half-Life 2, crashes the engine after restarting the currently loaded game/mod.
In Half-Life 2, it simply restart the game but doesn't switch to other games/mods.
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. The option was removed in Half-Life 2 since 20th Anniversary Update since Valve moved it to New Game menu (only when launched with -game hl2_complete), but it still works.
OpenMatchmakingBasePanel Unknown, maybe used for older versions of Team Fortress 2. On Source 2013 (also includes Team Fortress 2 branch and latest version of Team Fortress 2), this opens an transparent panel covering the whole screen (and in Team Fortress 2, also show small transparent black panel on top left), effectively making the menu unusable. Additionally in Team Fortress 2, displays Failed to load NULL error on console.
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.
Note.pngNote:Counter-Strike: Source Counter-Strike: Source uses OpenCSAchievementsDialog instead, attempting to open it will show no achievements on the list, and trying to interact with the filter will cause the game to crash.
OpenCSAchievementsDialog Shows the achievements dialog (for Counter-Strike: Source Counter-Strike: Source only) Shows a message if the player is not using Steam or is logged off.
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>. Some creative examples include engine connect.2341
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)
SwitchExpansion Loads a different expansion, similar to "SwitchCategory" λ Only has an effect or even works if the game is launched through steam and isn't on the "steam_legacy" beta branch or is launched with the "-game hl2_complete" launch param in either a terminal or .bat file. Each command used has the corresponding mod / game folder affixed to the end of it, "SwitchExpansion hl2" will change to base HL2, ".. episodic" will change to Episode One, etc. etc.
SwitchCategory Similar to "SwitchExpansion", though this will just switch your menu options available to those of a different mod.

Files

Inside the 🖿game or mod/resource folder.

References

GameMenu.res by massivegod https://gamebanana.com/scripts/2341

"gamemenu.res" ↑ - 🖿hl2_complete\resources\gamemenu.res ; Valve Software

Notes

λ: I have tried to add in more commands and menu options myself three times so far, I can get it to work almost entirely except for the fact it doesn't load any other game properly and will still keep the game that was previously loaded active. For example, if you added in menu options for "Portal" and tried to load the game through the HL2 20thAnniv menu, it would just not load it at all. It'll look like it loaded, but the loading bar is fake or it's just reloading the prior game files. So as far as I'm concerned, you will not be able to set up your own mods or other Source games (e.g., HL: Source, Portal) as I have tried and failed. This is less of a note, and more of a warning / advisement for others looking to try this. -veeanti