Talk:List of Team Fortress 2 console commands and variables

From Valve Developer Community
Jump to: navigation, search

Updating the ccmd/cvar list (updated)

Generating the dump

  1. Download the latest versions of Metamod:Source and SourceMod for your operating system.
  2. Extract both archives into the client gamedir (e.g. C:\Program Files (x86)\Steam\steamapps\common\Team Fortress 2\tf). There show now be an addons folder with both plugins inside.
  3. Navigate to addons/sourcemod/plugins and move all existing .smx files to the disabled folder (we don't want them running during the dump).
  4. Download the ccmd dump plugin I've written here (or compile from source) and place it in the same plugins folder. It should be the only plugin that's not disabled.
  5. Disable any other Source plugins you might have installed, like P-REC, for now (the dump plugin ignores P-REC's ccmds anyway but let's stay on the safe side).
  6. Add -insecure to your launch options (to allow unsigned plugins to run on client). Learn how to set Steam game launch options here.
  7. Open the game and start a listen server on any map (e.g. map itemtest).
  8. Ensure that the dump plugin is the only one loaded by running sm plugins list.
  9. Run sm_dump_ccmds in console. It should dump to a text file in addons/sourcemod/data. Move this file somewhere safe.
  10. To revert everything and make your game playable again, after closing it remove the -insecure launch option and delete the addons and cfg/sourcemod folders from the gamedir.

Updating the article

The dump text file contains a wikitext-formatted table that can be pasted onto this wiki, as well as an HTML comment with the build number and total ccmds. Follow these steps before saving changes to the article.

  1. Preview the table on the wiki and scroll through to find any incorrect min or max values (as a result of floating-point imprecision). You can also use the "Show changes" button to find incorrect changes in the table more easily.
    • The two main ones you'll always have to fix are:
      mat_viewportscale's min value, which displays as 0.001563 but is really 0.0015625 (1 ÷ 640) and
      viewmodel_fov's max value, which displays as 179.899994 but is really 179.9.
  2. Update the retrieval date, build number and total ccmds using the HTML comment, and then delete that comment as it's otherwise unneeded.

Caveats

  • Most commands and variables related to OpenGL are only available when the game is using OpenGL, so the plugin misses those when using DirectX.

Osyu (talk) 15:01, 31 August 2021 (PDT)

How to update the cvar/cmd list

IMPORTANT: If you have done this before, delete your previous version of cvarlist.txt or you will have quite a bit of confusion on your hands.

These instructions are written for a computer running Windows and involve using the console for Team Fortress 2 (TF2). Information on using the console can be found at the TF2 wiki's page on the console. Before starting to update the cvar/cmd list, it is a good idea to save your current settings for TF2 since updating the cvar/cmd list requires resting your game's settings. If you use a config or have an autoexec you should be okay, but it is still a good idea to create a copy of your current settings before beginning. To create a copy of your current settings enter

host_writeconfig

into the console. The command saves all of your current settings to the file config.cfg. When you are done updating the cvar/cmd list and want to return to your normal settings again execute the config by entering

exec config

into the console.

The first step to updating the cvar/cmd list is to open up your preferred text editor, such as Notepad, and then copy this code into a new text document. Next, save the document as defaults.cfg into your \cfg\ folder for TF2, usually found at C:\Program Files (x86)\Steam\SteamApps\common\Team Fortress 2\tf\cfg, while making sure to set the file type to save the file as to All files (*.*). This code resets a lot of commonly changed variables back to their default values. It is needed to so that your update to the cvar/cmd will accurately represent every variable and its default value.

To check that the config correctly restores the defaults to all the variables it is supposed to enter

exec defaults

into the console. After you do so, TF2 should become unresponsive and freeze for a bit. After it finishes loading, you should be prompted with a dialog saying READY TO PLAY?, click the (X) in the top right corner to close it. Once it has been closed, open up the options menu, and then click on the Advanced... box. A pop up should appear with a check box to enable the developer console. Select check the box, click OK, and then click OK again. Open the console again and enter the following

exec defaults

Wait again for TF2 to load and then enter

clear;differences

After that all you should see in the console is

"hap_melee_scale" = "0.800000" ( def. "0.8" )
 client
"hap_noclip_avatar_scale" = "0.100000" ( def. "0.10f" )
 client
"cl_overdraw_test" = "0"
 client cheat
"name" = "<Your Username>" ( def. "unnamed" )
 archive server_can_execute
 - Current user name
"mat_texture_list_all" = "0"
 cheat
 - If this is nonzero, then the texture list panel will show all currently-loaded textures.
"mat_texture_list_view" = "1"
 cheat
 - If this is nonzero, then the texture list panel will render thumbnails of currently-loaded textures.
"mat_show_texture_memory_usage" = "0"
 cheat
 - Display the texture memory usage on the HUD.
"r_worldlights" = "2" ( def. "4" )
 - number of world lights to use per vertex
"r_flashlightdepthtexture" = "0" ( def. "1" )
"mat_texture_limit" = "-1"
 - If this value is not -1, the material system will limit the amount of texture memory it uses in a frame. Useful for identifying performance cliffs. The value is in kilobytes.

The list that your console should now be displaying is all of the variables that were not reset to their default values. If you see more variables then the ones I listed, please leave a message on my talk page so that I can update the link for the information to put into defaults.cfg so that all variables are reset. Regardless, seeing something different isn't a problem. What variables are left in the console is important for future steps, so make a copy of the console's contents somewhere for future retrieval.

The next steps involve actually collect the new cvar/cmd list. Start by entering

clear;con_logfile cvarlist.txt;cvarlist

and then

con_logfile end

into the console. What this does is clears the console of any previous text, starts logging all console outputs to cvarlist.txt, outputs the cvarlist to the console, and then ends the recording to the cvarlist.txt file. Once you have run the command locate your \tf\ folder, usually found at C:\Program Files (x86)\Steam\steamapps\common\Team Fortress 2\tf\. Inside it there should be a text file by the name cvarlist.txt, it should now contain a list of all TF2's commands and console variables. The list of variables which were not reset to their default values are now needed. Inside cvarlist.txt find each of the variables that had its default value listed next to it in the form "<Variable Name>" = "*" ( def. "#" ), and change whatever is listed as its value to the value listed inside parentheses, the # in example given.

Now that you have a correct and complete cvar/cmd list, the next step is to update the page List of TF2 console commands and variables. Start by adding the date that you are doing this work on to the note at the top, as well as the build number of TF2 that you are running. To find out what build of TF2 you are running type

clear;map itemtest

into the console. The commands clear out the console and then load up the Itemtest map. Once Itemtest has loaded feel free to disconnect. In the console there should be something that looks like this

Team Fortress
Map: itemtest
Players: 1 / 24
Build: *******
Server Number: 1

copy down the number that is in the place of the asterisks (*) and use it to replace the build number previously listed at List of TF2 console commands and variables. As a side note, the Itemtest map isn't special, you can load up any map, but it in particular is easy to use.

Next, copy and paste corresponding sections of the cvarlist to the appropriate locations in alphabetical order, a helpful template for this can be found here. Finally, update the total number of commands and variables in the list using the number listed in a note at the end of the cvarlist.txt file.

If you have any questions feel free to contact me on talk page! The Editors Apprentice (talk) 17:15, 29 April 2020 (UTC)

norecord tags use

Knowing how ConVar flags work in-code, I'm assuming `norecord` is tied to the `FCVAR_NORECORD` flag, which forbids the ConVar/ConCommand from being recorded in demos.

I'd put that in the page itself, but I want to know you guys' opinion before I do so.

Thanks! Lonkfania (talk) 15:28, 7 August 2017 (UTC)


That sounds great! Adding it would be much appreciated! The Editors Apprentice (talk) 18:56, 21 October 2017 (UTC)

About Text Styling

Can the text color used for 'devonly' Concommands / Convars be altered? It looks too dark and blends into the background of the table. I suggest just keeping the text the same as 'hidden' commands, just that they have italics, would be appreciated! -- Orin (talk) 10:11, 11 October 2021 (PDT)