Skip to content

Compiletime and Runtime

WhyIsEvery4thYearAlwaysBad edited this page May 3, 2021 · 15 revisions

Compiletime

Note: this program only generates the neccessary files needed for compilation. You will have to compile the captions and convert the main directory to a VPK.

Command-Line syntax: <generator executable path> <source file> [-o, --outputdir] [-h, --help]

  • <generator executable path> - File path to the generator.
  • <source file> - Path to file used for compilation.
  • -h, --help - Displays the help menu.
  • -o, --output-dir - Output directory for configuration and caption files.

Runtime

After compiling your command menus you then drop the output folder into <gamepath>/custom or just <gamepath> if there is no custom folder (e.g tf/custom). Now you need to execute "exec cmenu_initialize" before using your command menus, otherwise they will not work; this can be done manually or by putting the aformentioned line into a CFG file executed automatically. Should the installation process be properly followed, the message echo [Command Menu Generator] Initialized command menus! should appear in console, which signifies that your CMenus can be ran.

To actually use the command menu you want, you first need to peer into your compiled command menu folder (and then the cfg folder), and then use the formatted and unformatted names of your command menus to figure the file of the wanted command menu. After that it's as simple just execing that command menu. Now the method used to run your command menus is based on preference, but I have templates of some methods below if you don't want to work out how to open them yourself.

Code template if you want to open/close a command menu by holding/releasing a key:

alias +<name> "exec $cmenu_<unformatted command menu name>"
alias -<name> "cmenu.exitmenu"
bind <KEY> +<name>

Code template if you want to open/close a command menu by pressing a key once/twice:

bind <KEY> +<name>
alias +<name 1> "exec $cmenu_<unformatted command menu name>"
alias -<name 1> "alias -<name> -<name 2>; alias +<name>	+<name 2>"
alias +<name 2> "cmenu.exitmenu"
alias -<name 2> "alias -<name> -<name 1>; alias +<name> +<name 1>"
-<name 2>

To open the command menu you want simply look into the complied command menu folder for the target command menu's unformatted name, which is prepended with "$cmenuopen_". If your compiled command menu is a VPK, then open it with either GCFScape or the VPK compiler that generally comes with your target Source game.

(If you need to change the cc_lang cvar at any time, the caption language that this program uses is commandmenu)

Caption Displays

If your command menus use captions, then you may notice that the display is slow and not where you want it to be. This is likely the result of your HUD. To change it locate your HUD's "hudlayout.res" file and find the "HudCloseCaption" element. The HUD element should look close to this:

HudCloseCaption
{
	"fieldName" "HudCloseCaption"
	"visible"	"1"
	"enabled"	"1"
	"xpos"		"c-250"
	"ypos"		"276"	[$WIN32]
	"ypos"		"236"	[$X360]
	"wide"		"500"
	"tall"		"136"	[$WIN32]
	"tall"		"176"	[$X360]

	"BgAlpha"	"128"

	"GrowTime"		"0.25"
	"ItemHiddenTime"	"0.2"  // Nearly same as grow time so that the item doesn't start to show until growth is finished
	"ItemFadeInTime"	"0.15"	// Once ItemHiddenTime is finished, takes this much longer to fade in
	"ItemFadeOutTime"	"0.3"
	"topoffset"		"0"
}

Note that the actual HudCloseCaption you need to modify will vary based on the HUD itself.

Now set GrowTime, ItemHiddenTime, ItemFadeInTime, and ItemFadeOutTime to 0; those values delay the appearance and disappearance of captions, which is bad if your command menu(s) use(s) captions to display your binds. The other values are up to your choosing, as their optimal values are subjective.

Clone this wiki locally