Half-Life

Half-Life

33 ratings
Making a command panel
By Meha931
Make your own command panel with all commands that you need without binding them to keys!
May be useful for configuring listen servers and activating scripts.
   
Award
Favorite
Favorited
Unfavorite
Introduction
If you have played Team Fortress Classic then you should be familiar with the panel. Engineers and Spies have to use it to do some actions (building; disguising). In TFC it is opened with SHIFT, in some other games like Counter-Strike it is bound to H.
The command panel (or command menu, I'll be referring to it as panel) can be used to run some commands quickly and in more convenient way than binds (though binds can be accessed instantly).
This guide assumes that you are familiar with basic scripting in GoldSource (or at least Source) games.
Creating the panel
To create the panel, make a new text file commandmenu.txt in a folder of the mod where the panel should be used. If you are going to use it in Half-Life, make the file in valve folder, if it's HL:Opposing Force, the folder is gearbox, and so on.


To be able to access the panel, bind +commandmenu to any key of your choice. Although this command starts with a plus sign (like +forward or +attack), you can press the button without holding it to open the menu.
Syntax
To have your commands in the panel, you have to edit commandmenu.txt in a proper way.
Here's some information about the syntax from TFC menu:
Originally posted by commandmenu.txt of Team Fortress Classic:
// Command Menu definition // // Basic Format: // "<Bound Key>" "<Button Text>" "<Command sent to server>" // // Or you can check for a specific class: // <Class> "<BoundKey>" "<Button Text>" "<Command sent to server>" // Where <Class> is one of: SCOUT, SNIPER, SOLDIER, DEMOMAN, MEDIC, HWGUY, PYRO, SPY, ENGINEER // // Or you can check for a specific map: // MAP <MapName> "<BoundKey>" "<Button Text>" "<Command sent to server>" // Where <MapName> is the name of the map, without the ".bsp". // // Or you can check for a specific team: // TEAM1 "<BoundKey>" "<Button Text>" "<Command sent to server>" // TEAM2 "<BoundKey>" "<Button Text>" "<Command sent to server>" // TEAM3, TEAM4 work as well // // Buttons can also open up submenus, as follows: // { // "Some More Options", // { // ... // } // } // // Class can be any of the following: // SCOUT, SNIPER, SOLDER, DEMOMAN, MEDIC, HWGUY, PYRO, SPY, ENGINEER // Buttons prepended with a class name will only be seen if the player // is that class. // // Buttons preceded with "CUSTOM" are handled in special ways. They can only be moved // around or deleted. // // // Limitations: // Maximum of 40 menus. // Maximum of 100 buttons per menu.

So basically the panel consists of buttons:
"1" "Button 1" "command1" "2" "Button 2" "command2" "3" "Button 3" "command3"

...and submenus:
"1" "Button 1" "command-b1" "2" "Submenu 1" { "1" "Submenu 1 button 1" "command-s1b1" "2" "Submenu 1 button 2" "command-s1b2" "3" "Submenu 1 submenu 1" { "1" "Submenu 1-1 button 1" "command-s1s1b1" "2" "Submenu 1-1 button 2" "command-s1s1b2" } "4" "Submenu 1 button 3" "command-s1b3" } "3" "Button 2" "command-b2"

Some buttons and submenus can be specified to a map so they only show up when you are playing on that map:
"1" "Button 1" "command1" "2" "Map specific" { "1" "All maps" { "1" "Say: Where are you?" "say Where are you?" "2" "Say: Stop spamming tau!" "say Stop spamming tau!" } MAP crossfire "2" "CROSSFIRE" { "1" "Say: No button" "say Do NOT touch that button!" "2" "Say: Camper" "say Camper :(" } MAP 2000_2_new "2" "2000_2_NEW" { "1" "Say: Try to find me" "say Try to find me" "2" "Say: Coming" "say I'm coming for you >:)" } }

To add a command that requires user input, use messagemode command_name. For example, messagemode impulse will open a chat box, but "say" will be replaced with "impulse", and if you type a number the game will execute impulse <number>
"1" "Load map" "messagemode map" "2" "Change map" "messagemode changelevel" "3" "Impulse" "messagemode impulse" "4" "Record" { "1" "Start" "messagemode record" "2" "Stop" "stop" "3" "Play" "messagemode playdemo" }

It seems that positions of brackets don't matter. You can code the submenus the other way:
"1" "Button 1" "b1" "2" "Sub 1" { "1" "Button 1" "b1-1" "2" "Sub 1" { "1" "Last button" "bb" } }

To exit the panel you can add a button with slot10 command at the end of the file:
"0" "Exit" "slot10"
Some uses
  • Administration: changing maps (messagemode map/changelevel), executing RCon commands (messagemode rcon/rcon_address/rcon_port/rcon_password)
  • Quick chat responses without the need to remember what each key sends
  • Executing custom configs
  • Recording (messagemode record/playdemo and stop)
  • Spawning entities
7 Comments
PterribleDactylus Sep 16, 2023 @ 3:57pm 
I made a little command menu, and posted a guide for the code for that. I credited you for this guide, nice stuff man!
https://steamcommunity.com/sharedfiles/filedetails/?id=3036771444
Meha931  [author] Sep 9, 2023 @ 11:20am 
I am not sure if this can be applied to Source games like Portal, only GoldSrc games have command menus
Not counting other types of menus like radio panels in CS/CSS/CSGO, these can be edited too (at least in csgo, I might make a guide on that too)
But Portal doesn't have any menus as far as I know
ahbpo Sep 9, 2023 @ 4:38am 
What if I want to make a command panel for, say, Portal? Do I just create a "valve" folder in the files?
Drakonuid5 Jul 19, 2022 @ 7:39am 
Tanks very much
JK Jul 14, 2022 @ 12:25pm 
Really good guide. Thank you.
Na-Nu-X Dec 4, 2021 @ 2:24am 
Thank you
☭ Soviet Human ☭ Oct 2, 2019 @ 7:14am 
Яб может сделал, но у меня как минимум нет своего сервера (ибо нах надо), ну и гемор канеш + лень))