Scripting FAQ

From Team Fortress Wiki
Revision as of 05:45, 1 July 2010 by Shackanaw (talk | contribs) (Requesting move to Scripting FAQ)
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

How do we remove scripts?--B-MAN 09:57, 1 May 2010 (UTC)

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.