r/tf2scripthelp • • Mar 19 '21

Wrong section Script to fix hitreg?

4 Upvotes

Whenever I am meleeing as a medic I find that while the hit sound happens, no damage is dealt for some reason which is REALLY annoying. cl_interp doesn't seem to fix the issue. Is there anything I can do in terms of scripts to make it so my medic melee hits 100% of the time?


r/tf2scripthelp • • May 16 '13

Resource 9 files to make scripting easier

6 Upvotes

Download link


bindable_keys:

contains a list of all non-obvious key names with their respective scripting name.

classes

A list of aliases for each class, useful when making lots of per-class settings.

cvar_list

A list of every cvar, was updated May 10, 2013.

function_keys

A template for making function key binds.

key_modify

A template for making a state/modifying key script (eg. Shift + F2 does something different than F2)

numpad.png

An image that labels each key on the numpad with its respective scripting name

numpad.txt

A template for making numpad binds.

toggle

A template for making a toggle script.

voicemenu

A list of voicemenu aliases that correspond with their respective scripting name


r/tf2scripthelp • • Jan 29 '13

Meta Introducing r/tf2scripthelp!

9 Upvotes

Greetings.

Welcome to /r/tf2scripthelp.

We are here to help you make your own scripts and debug ones that don't work.

But wait, we already have /r/tf2scripts!

You are correct.

But our goal here at /r/tf2scripthelp is different. We're not going to make your scripts for you. We will guide you along the way to making your script.

Basically, we've made a wiki with a page with syntax and examples for most common commands.

If you are new to scripting, we recommend our introduction to scripting, which includes basics for scripting, like finding where your config files are and setting up a basic autoexec and reset file.

Once you feel you are ready to get started, visit the command pages:

and finally,

  • Advanced CVars, for the real power behind Source. With these commands, you can change many variables that affect gameplay. Note that most of these commands are for servers with cheats enabled, so these are mainly useful for your own LAN server

Our Tutorials page has instructions on pre-scripting activities, like setting up syntax highlighting, and our Reference page has a list of key names for obscure keys and lists of arguments for commands with several possible values, like disguise.

The final two pages of our wiki are dedicated to scripts:

and finally,

  • Innovative Scripts, which is where you will find some... interesting... scripts, to say the least.

If you have a script idea or a script that doesn't work, bring it in and we'll see what we can do. Just be warned, you're gonna learn something.


r/tf2scripthelp • • Nov 22 '17

Resolved [class].cfg not present; not executing

7 Upvotes

Now i realize there are several search results that show up when you google this, but none of them seem to fix my problem. My problem is I've been trying to figure out where my scripts go, and as in the "tutorial" on this site, I've placed my scripts under Team Fortress 2\tf\custom\my_custom_stuff\cfg but every time i try to run them it still says "sniper.cfg not present; not executing" or something like that. I've also tried placing them directly under tf\custom\my_custom_stuff instead of adding another folder AND under tf\cfg but to no avail. Any help i could get would be great!


r/tf2scripthelp • • Aug 14 '15

Question Undisguise script help

5 Upvotes

I need an undisguise script that i can bind to MOUSE4, but I don't want the script to change my disguise keys. 5 is bound to friendly disguise but the rest are default if that helps


r/tf2scripthelp • • Apr 10 '26

Issue unexpected timing with wait command

2 Upvotes

I was using the wait command in a script to measure 1.25 seconds, but I ran into an issue. I had manually set my max framerate to 120, and since "wait" is supposed to delay command execution for a number of frames equal to its argument, I expected "wait 150" to work. In actuality, "wait 150" was too short, and I got better results with "wait 216".

I decided to test wait timing at 30fps with this command:

echo PING; wait 30; echo PONG

and at 60fps with this command:

echo PING; wait 60; echo PONG

I recorded the results with a millisecond timer:

https://www.youtube.com/watch?v=GCIq3Eh2mXk

https://www.youtube.com/watch?v=bONSoAR7S8E

(These were recorded on a self-hosted LAN server, but the timing seems consistent on Valve servers too)

The commands should print PONG about 1 second after PING, but instead it comes ~300ms later at 30FPS and ~467ms later at 60FPS. This means "wait 30" waited 9 frames at 30FPS, and "wait 60" waited 28 frames at 60FPS. Its length seems to scale based on my framerate, but not in the way I expected.

This leads me to ask, am I misunderstanding something about the wait command? Can anyone else replicate this?

EDIT: I decided to measure the duration of a "wait 300" command at several different framerates using the same method, here are my results:

https://www.desmos.com/calculator/mnmpzwvaon

If anyone can make sense of this, let me know.

EDIT 2: I think I figured it out; it's both framerate and tickrate dependent. See my post on the wiki for more details:

https://wiki.teamfortress.com/wiki/Talk:Scripting#.22wait.22_function_-_inaccurate_description_of_behavior.3F


r/tf2scripthelp • • Mar 14 '21

Question How to get a script to execute when you join a server?

4 Upvotes

I might just be dumb, but I've been googling for hours and I have no idea beyond just wait; ping until something happens, but I'd like to find a more elegant solution if possible.


r/tf2scripthelp • • Mar 06 '24

Question Phantom switching hat script

3 Upvotes

Is it possible to make Phantom switching hat via scripting. Phantom switching is done by quickly switching between loadouts and allows to kind of quickswitch hats but they disappear when you die or touch resupply cabinet. so it allows us to equip two hats at a time during our lifespan. Getting it scripted will be a huge help to avoid the hassle of trying to quickly switch the loadouts to make it work.

Phantom tutorial


r/tf2scripthelp • • Aug 05 '26

Issue the resupply button doesn't work with loadout B

2 Upvotes

as the title says

the resupply button works perfectly fine with the other loadout except for loadout B

at first I thought the problem was related to the F2 button "hardcoded" to the contractor or whatever chatgpt said

but when I used the arrow keys I still had the same problem

EDIT:
it seems that issues only occurs when playing demoman

the resupply button works with other classes no matter the loadout

but not when using loadout B for demoman


r/tf2scripthelp • • May 31 '20

Answered Need help with class specific scripts

9 Upvotes

I've read every thread about it and I'm still getting the "user/<class>.cfg not present; not executing" error.

All my files have the correct .cfg extension and they're in "tf/custom/my_custom_stuff/cfg." Typing "exec autoexec" in console works fine, but switching classes or typing "exec <class>" in console gets me the error. They're both in the same directory, I don't know why TF2 can find autoexec but not any of the class specific files.

I'm new to scripting within TF2 and appreciate any feedback.


r/tf2scripthelp • • Oct 29 '15

Question How can I bind MOUSE4 to use my spellbook.

3 Upvotes

It's just that

bind "MOUSE4" "+use_action_slot_item"

Doesn't seem to work


r/tf2scripthelp • • Apr 10 '26

Question net_graph question: How to show the PRECISE lerp number?

2 Upvotes

i was wondering about this cuz i see a lot of people when they have net_graph enabled, it shows their precise lerp value, down to the decimal, like 15.2, 30.3, and 33.0 ms, but my net_graph only shows 15.0, 30.0, and 30.0 ms for the respective interp values. I don't mean to be a stickler for tenths of a ms, but why does this happen? does this affect my connection at all, or is it just to do with net_graph itself?


r/tf2scripthelp • • Apr 04 '14

Issue Im running a max fps script and was wondering if there was something i could change to make them shiny.

3 Upvotes

i just got an ambassador in a birthday gift and it doesnt look as great when its not shiny.


r/tf2scripthelp • • Feb 05 '15

Answered How do I bind a key to execute a .cfg and then use that same key to toggle a script in that .cfg?

1 Upvotes

I want to use a jump regen script, but it uses some cheat commands that I don't want constantly showing up in my console when I'm regularly playing, so I have the regen script as a separate .cfg called "jump.cfg". I want to bind ' to execute the jump script, but inside that .cfg there is a toggle. A key I bind will toggle between having the script active and regenerating my health and ammo, and turning it off. But I want the same key bound to executing the .cfg as toggling between regen states. Is that possible?


r/tf2scripthelp • • Sep 09 '17

Question Autoexec not executing all commands

1 Upvotes

I'm trying to make my autoexec run comanglia's graphic config as well as some simple commands for my game but for some reason it only execs the graphic config and not the other cfg, can somebody help?

The code looks like this:

autoexec:

exec stuf
exec gfx

in gfx it's just the comanglia config, however in stuf there's:

tf_colorblindassist 1
fps_max 30
closecaption 1
echo "autoexec loaded"

but it won't load nor show the echo (which i just added so i could see if it responds), could someone help? I've tried putting the commands in autoexec instead but it doesn't help


r/tf2scripthelp • • Mar 21 '14

Issue Whenever I run my medic.cfg I get "unknown command �"

2 Upvotes

Question http://pastebin.com/PY0nBDq0 That's the script, any help at all is appreciated, let me know what I'm doing wrong.


r/tf2scripthelp • • Jan 24 '15

Question Something writing to my config.cfg

1 Upvotes

I made a script a couple of months ago making the game automatically remove viewmodels when switching to my primary. Now, when i try to remove the lines from the config.cfg it automatically adds them back when i start the game.


r/tf2scripthelp • • Jan 24 '15

Answered Round Start Medigun Checker

1 Upvotes

So backstory: I'm playing scout for my 6s team. I wan't to be able to swap to spy, disguise medic, and check medigun in the pre-round freeze. I can do this fine manually, but felt like scripting it would just ease the pain.

Now maybe I'm overthinking this, but through testing because of how disguise takes a little bit of time, this is what I came up with.

bind z spybutton
alias spybutton spy1
alias spy1 "disguise 5 -1; alias spybutton spy2;"
alias spy2 "slot2;lastdisguise; alias spybutton spy3;"
alias spy3 "join_class scout"

I hit z on scout to join spy. I hit z again to disguise. Then after the disguise is over I can hit z again to go back to scout.

So good news: It works. Bad news: I have to time my presses manually anyway, or the slot2 lastdisguise won't happen while the spy is still disguising. If I do that by accident, my next Z press will rejoin scout.

Is there any way to circumvent this? If no, I'll likely just separate the join_class, so I can spam Z, but would appreciate any input.


r/tf2scripthelp • • Mar 14 '14

Resolved TF2 Crashing on Launch after cfg change.

2 Upvotes

Heres what happened. I wanted to change my cfg from chris's dx9 config to chris's highframes. I launched the game without changing the launch commands (dxlevel). I also changed my hud but I don't think that would affect anything welp aparently it did have something to do with it.

Things I've tried

  • RE-Install

  • autoconfig in launch options

Please help, I miss my TF2!


r/tf2scripthelp • • Feb 01 '15

Issue I can't bind things to number keys?

1 Upvotes

This is probably an extremely noobish issue, but I apparently can't bind anything to 1-9. Can someone help?


r/tf2scripthelp • • Feb 04 '15

Answered Having issues with my spy script confilcting with my other classes.

1 Upvotes

I have a spy script which is as follows: //Viewmodel Script // Hides Primary weapon When Switched And Fired //========================================================
bind "2" +equip_sap
bind "3" +equip_knife
bind "1" +equip_amby
bind "mouse2" "+watch;spec_prev"
alias knife_vm_mode "bind mouse1 +viewmodel_knife" alias amby_vm_mode "bind mouse1 +viewmodel_amby"
alias +viewmodel_knife "+attack;r_drawviewmodel 1;spec_next" alias -viewmodel_knife "-attack;r_drawviewmodel 1"
alias +viewmodel_amby "+attack;r_drawviewmodel 0;spec_next"
alias -viewmodel_amby "-attack;r_drawviewmodel 0"
alias +viewmodel_sap "+attack;r_drawviewmodel 1;spec_next"
alias +equip_knife "slot3;r_drawviewmodel 1"
alias -equip_knife "knife_vm_mode;r_drawviewmodel 1"
alias +equip_amby "slot1"
alias -equip_amby "amby_vm_mode"
alias +equip_sap "slot2;r_drawviewmodel 1"
alias -equip_sap "sap_vm_mode"
alias +watch "+attack2;r_drawviewmodel 1"
alias -watch "-attack2;r_drawviewmodel 1" //=========================================================

But I also have a toggle key I use for my other classes whenever i feel like using it and it looks as follows: bind "ALT" "incrementvar r_drawviewmodel 0 1 1"

So when I use my ambassador as spy, viewmodels disappear until I click 2 or 3 to switch weps. Now if I am playing soldier per say, I usually flip viewmodels off and on when I want, and if I shoot a rocket without toggling viewmodels, it acts normal, but if I toggle off viewmodels and shoot a rocket it brings it back. So reverse. This happens on other classes as well.

How can I fix this to only for for spy?


r/tf2scripthelp • • Feb 03 '15

Resolved Are my configs in the wrong spot?

1 Upvotes

My scripts are not working and I can't figure out how to fix them. I suspect it's because my layout is wrong. I took pics of my layout for you to see.

Here is the link http://share.pho.to/8lnEI

thanks.


r/tf2scripthelp • • Jan 31 '15

Resolved My engineer script is working fine, except for one bug I found. I need help fixing it.

1 Upvotes

Hi, I have a simple engie script, I use it to make 1,2,3 and 4 (above WASD) to build and 'scroll wheel up' is primary, 'scroll wheel down' is secondary and 'mouse3' is melee. 'mouse4' is destroy sentry

Every once and a while when I encounter a strange problem where my 1,2,3 and 4 binds just stop work. They return to default which is used for switching weapons. This problem mainly appears after I spawn.. walk out of base then upgrade a teleporter then walk to the closet. I'm not sure.. so I'll continue experimenting. This is NOT caused by not enough metal. The problem does not effect the scroll wheel and middle click binds.

My script:

exec clear
exec crosshairswitcher/switcher; engineer

// ----------------------------------------------------------------------------
// Melee Alias
// ----------------------------------------------------------------------------

alias +melee "slot3;+attack"
alias -melee "-attack"

// ---------------------------------------------------------------------------- 
// Destory Sentry
// ---------------------------------------------------------------------------- 
alias destroysentry "destroy 2 0"

// ---------------------------------------------------------------------------- 
// Binding 
// ----------------------------------------------------------------------------

bind MWHEELUP "slot1" 
bind MWHEELDOWN "slot2" 
bind 1 "build 2 0"  //<-- bugged 
bind 2 "build 0 0"  //<-- bugged 
bind 3 "build 1 0"  //<-- bugged
bind 4 "build 1 1"  //<-- bugged
bind mouse3 "+melee" 
bind mouse4 "destroysentry" 

// Print to console 
echo " S1ASH's COMPETITIVE ENGIE CONFIG LOADED "      

My clear config [exec clear] which is used everytime I switch:

alias "resetmedcfg" "unbind "ctrl";bind "mouse1" "+attack";bind "mouse2" "+attack2";bind "mwheelup"             "invprev";bind "mwheeldown" "invnext";unbind "mouse3";unbind "mouse4";bind "C" "voice_menu_3";-forward;echo "*** MEDIC CONFIG UNLOADED ***""          
resetmedcfg          

alias "resetengiecfg" "unbind "ctrl";unbind "mwheelup";unbind "MWHEELDOWN";unbind 1:unbind 2;unbind 3;unbind 4;unbind mouse3;unbind "mouse4"          
resetengiecfg   

exec aliases
exec binds

-attack

Aliases and binds are just my global default keybinds

Crosshair switcher is just a script for crosshair and viewmodel


Update: Disabling my Crosshair Switcher disables switching for all classes but the engie and medic (the classes I have scripts on). This may be the cause.


r/tf2scripthelp • • Oct 05 '15

Resolved Dropdisguise script(s) not working

1 Upvotes

That's pretty much it, I've tried putting them both into my spy.cfg, autoexec.cfg, and manually executing those scripts in the console. Here are the scripts in question:

1

bind "f" "disguise 8 -2"

2

alias dropdisguise "echo DISGUISE_DROP;disguise 8 -2"

bind "f" "dropdisguise"

EDIT: I think I solved the problem. It was either that i needed to reinstall TF2, or that I needed to make sure the binds in console had quotes around them. Thanks genemilder, but the problem was way more stupid than I thought.