10

I just started scripting and have a bunch for spy (to modify the cursor, remove view model, modify sensitivity, rebind keys, etc.). How do I prevent scripts in the spy.cfg class file from spreading to all my other classes?

3

You cannot prevent this due to the way .cfg files work.

What you can do is, if a setting appears in at least one class, write the default setting to all the other class config files.

To go a step further, make a .cfg file with all those default settings and execute it at the beginning of each class config file. No further hacks will be required.

|improve this answer|||||
  • "make a .cfg file with all those default settings and execute it at the beginning of each class config file" how do you go about doing this? – I Phantasm I Dec 10 '11 at 1:52
  • To execute a cfg file from within another cfg file in the same directory, use the exec command: exec some_other_file.cfg – Steve V. Dec 10 '11 at 6:17
  • exelent ty, do you happen to no the defaoult cursor in tf2 it says none is there a specific command or is this not possible? – I Phantasm I Dec 10 '11 at 6:41
  • You don't give any exact information how to solve the problem. – user598527 Nov 30 '16 at 17:47
5

The Solution:

Make a script for each class, and place exec config.cfg at the top of each one.

This config file contains all your default settings, and should clear any key bindings and other assorted changes.

This should unclutter your scripts quite a bit.


Important Note:

Any excessively strange settings you may have created that aren't in the 'default' setup of TF2 may not be undone by this, so you may have to include your own code to undo them.

If this is the case, make a separate config file and place the code to clear them in that file. Then, simply place exec <custom reset script name>.cfg before exec config.cfg in each class script.

|improve this answer|||||
  • Shouldn't you use exec reset command instead? reset.cfg file has to be created first. – user598527 Nov 30 '16 at 17:45
3

Create reset.cfg file in ~\Team Fortress 2\tf\cfg, it resets all the values you change in your various class configs.

Then, add exec reset.cfg as the top line to all 9 class config files:

  • scout.cfg
  • pyro.cfg
  • soldier.cfg
  • demoman.cfg
  • heavyweapons.cfg
  • engineer.cfg
  • medic.cfg
  • spy.cfg
  • sniper.cfg
|improve this answer|||||
  • 1
    Can you send a link or something that has like a reset config or something? – sKantei Jul 4 '16 at 15:29
  • @sKantei: What do you mean? Create reset.cfg file in ~\Team Fortress 2\tf\cfg. – user598527 Nov 30 '16 at 17:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.