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?

0

3 Answers 3

5

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.

4
  • "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? Commented Dec 10, 2011 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.
    Commented Dec 10, 2011 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? Commented Dec 10, 2011 at 6:41
  • You don't give any exact information how to solve the problem.
    – user598527
    Commented Nov 30, 2016 at 17:47
6

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.

1
  • Shouldn't you use exec reset command instead? reset.cfg file has to be created first.
    – user598527
    Commented Nov 30, 2016 at 17:45
4

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
2
  • 1
    Can you send a link or something that has like a reset config or something?
    – sKantei
    Commented Jul 4, 2016 at 15:29
  • @sKantei: What do you mean? Create reset.cfg file in ~\Team Fortress 2\tf\cfg.
    – user598527
    Commented Nov 30, 2016 at 17:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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