Scripting Faq

From TF2 Wiki

Jump to: navigation, search


Global Script Questions

Print Console to TXT file from Console Command

Posted by Josiah
  • Q. Is there a way to Print the contents of the console to a txt file through a console command? I set up a simple script for my server to print out the status and go right to the ban menu of sourcemod. We have some bookkeeping practices for my server where we like to keep steam ids of banned people. There fore I want to get that status list in to a simple text file so it can be accessed later.
  • A. There is a command called "condump" that saves all of the text currently in the console window to a condump###.txt file in team fortress 2/tf. It saves the entire console, but your status list would just be at the bottom. --IAmThermite 21:25, 13 September 2009 (UTC)

HUD On/Off

Posted by Bolange
  • Q. Is there anyway to turn the HUD on or off for use in a script?
  • A. cl_hud_minmode set to "1" will give you a minimalist HUD view, you can also set this by going to your Options->Multiplayer. If you want to completely remove all HUD items though, you can use the commands cl_drawhud 0 to remove the HUD and r_drawviewmodel 0 to remove the gun (useful for screenshots), but Valve seem to have now classed these commands as cheats so they can only be used when sv_cheats is set to "1" --Aurora 01:00, 22 November 2007 (BST)

Reloading .cfg without closing the game?

Posted by Jabu2oz
  • Q. Is there a way of "refeshing" a .cfg file (e.g. autoexec.cfg) without closing/reopening TF2? This would be useful when trying out scripts. (NB, I have tried "exec autoexec" from the console (and restarting the server) but this didn't seem to work).

Edit: Thanks, "exec autoexec.cfg" worked, but I did have to start a server without commentary mode on (single player). --Jabu2oz 15:10, 19 December 2007 (CST)

  • A. Did you try "exec autoexec.cfg" from the console? You need to give it the full file name if memory serves. If you're working with a server, some settings require a map change to take effect (sv_pure comes to mind here). -- WanderingFox (Talk • Contribs) 15:15, 18 December 2007 (CST)

Removing Scripts

  • Q. How to remove scripts?
  • A. Simply open the file where you pasted the script ie. "Classname".cfg and delete the script. Save the modifications ( the suppression of the script ) and close the file. That should have done the trick. For configs that bind keys for all classes, ( Mouse1 bound to "+heal" which is the medic's command to heal, for example, disables any attack command with any other class) you just delete all .cfg files, including both config and it's copy. ( the 10k files, as opposed to the 1k files) once launching the game again, it recreates all of them with the default binds, you might nevertheless have to change a couple in the TF2 in-game options. If you do not wish to do so, you can manually change the binds in the config files, but you must do so in the main config file aswell as it's copy or it will not work. Reinstaling the game does NOT change the configs as they are stored in your steam file.

Class Specific Script Questions

Multiple Key Binds

Posted by Bolange
  • Q. Is it possible to make a variable to use the same key with multiple bindings depending on the class you are? e.g. In Spy, press F1 to disguise in Scout, in Engineer, press F1 to build a sentry etc...
  • A. Yes, however you will need to create separate scripts for each class, i.e. spy.cfg and engi.cfg and put the binds in these, see the Class Config Community Scripts for more information. --Aurora 14:10, 21 November 2007 (BST)

CTF Getting -or not- Intelligence as Spy

Posted by Xerox
  • Q. Is there a way to bind a command for not to take enemies intelligence when you're in Spy, unless you press a key? You might need it if a sentry is very near the case and you want to sap it first.

Personal tools