r/Tf2Scripts • • Apr 17 '16

Script Fake spinbot script

20 Upvotes

alias "spintoggle" "spintoggle1"
alias "spintoggle1" "+right; cl_yawspeed 9999999; sensitivity 100; alias spintoggle spintoggle2"
alias "spintoggle2" "-right; cl_yawspeed 210; sensitivity 3; alias spintoggle spintoggle1"
bind alt "spintoggle"

***Check what your sensitivity is and replace "3" in the second line before you use this script. Also, change alt to whatever button you want to toggle this script. Also, I don't think cl_yawspeed does anything other than change the speed for +left and +right, but change it back to your default if you want to.

Since there's no working command for looking up and looking down that I know of, I just changed the sensitivity; to be most convincing just move your mouse up and down a bit. Also, cl_yawspeed might need a little tweaking to be the most convincing; this was just tested in tr_walkway in thirdperson mayamode, not much else.


r/Tf2Scripts • • Jan 31 '13

Discussion [Curious] What are your most innovative or creative scripts?

19 Upvotes

What are your most innovative or creative scripts?

The scripts can be weapon specific as well as general :)

I'm mainly interested in new ideas that optimize efficiency in competitive or noncompetitive matches.

For example, I use a close-quarter explosive script so that when I play as the soldier or demoman, primary weapons all fire and jump to minimize damage from close-range explosions; the damage is registered as an explosive-jump and since no crouching is present, the knock-back from the explosions are minimal. I also use this script to duck-tap rocket-jump with soldier and have this deactivated when my explosive-jumping scripts are activate.


r/Tf2Scripts • • Feb 26 '22

Request So there's that sign on my screen. How do I disable it. It's very distracting

Post image
18 Upvotes

r/Tf2Scripts • • Oct 16 '13

Satisfied [Help] How do I bind a key to change loadout?

18 Upvotes

I want to have a key that changes my loadout from slot C to A, however I do not know the commands.

Also, I've been having a problem where I'm not automatically changing weapon when inside a spawn area when I change it on my loadout even though I have the option ticked, anyone have any idea how to fix it? (Also, what is the command for that option?)


r/Tf2Scripts • • Jul 23 '22

Script I wrote a brainfuck interpreter in console

17 Upvotes

This is my first high-level script so it probably isn’t that good. However, it allows brainfuck programs to run in the console, which I think is really cool.

Feel free to tell me any optimizations or tips on documentation, or if you want to know how any of the code works. It’s a little hack-y, but it works!

Scripts: https://github.com/MrShwhale/source-bf


r/Tf2Scripts • • Apr 17 '19

Meta [Script guide] A basic guide to hiding TF2 viewmodels

17 Upvotes

Over the last couple years of browsing the TF2 scripting subs ( r/TF2Scripts and r/TF2Scripthelp ), I've seen a lot of questions regarding viewmodels. Some people want to hide all of them, some want only their primary weapon invisible. Some want to add custom crosshairs and custom fov's per weapon.

I decided to make this (basic) guide, to be able to answer some of the questions that I usually see those people ask.

I'll try to go over most options that you'd have to consider when writing or choosing a script to hide your viewmodels. I hope that this can act as a guide for someone who previously had no idea where to start.

I'll assume that the reader knows at least the bare basics of scripting, and as such, has an autoexec already. If you are new to scripting, you can start here.

Any of the code snippets here can be put directly into such an autoexec. For some cases I will also mention class configs (including a reset.cfg). For more info on setting up an autoexec and/ or class configs, check this.

If I made any mistakes, or if you have any questions/ comments in general, please do let me know (feel free to PM me for help). Also don't be afraid to @ me in a different thread if you need help.

1. Hiding viewmodels

First of all, the easiest and most straightforward solution is to hide all of your viewmodels:

r_drawviewmodel 0

You could, for example, choose to use this with class-configs. You could put an r_drawviewmodel 0 in your scout.cfg, with an r_drawviewmodel 1 in your reset.cfg. This way only your scout's weapons will be invisible.

You could also use it with a button, to toggle all of them off and on:

bind X "toggle r_drawviewmodel"

2. Basics of slot specific viewmodels

2.1 Basic number binds

The next option would be to edit your basic slot1-3 binds, and have each of them update the viewmodel for that specific weapon. This is what you would do if you wanted only your primary weapon invisible.

bind 1 	"slot1; r_drawviewmodel 0"
bind 2 	"slot2; r_drawviewmodel 1"
bind 3 	"slot3: r_drawviewmodel 1"

Obviously this code only works for those that do not use the previous/ next weapon and lastinv commands (scrollwheel and Q, resp.), which brings us to the next option.

2.2 Custom crosshairs/ fov

This (and any code shown beyond this point) could can also be altered for use with custom crosshairs and/ or viewmodel_fov, e.g.:

bind 1 	"slot1; r_drawviewmodel 0; viewmodel_fov 60; cl_crosshair_file crosshair1"
bind 2 	"slot2; r_drawviewmodel 1; viewmodel_fov 60; cl_crosshair_file crosshair2"
bind 3 	"slot3: r_drawviewmodel 1; viewmodel_fov 90; cl_crosshair_file crosshair3"

Check this post for more info on custom crosshairs (long).

2.3 A simple solution for quickswitch

Another option would be to add a "quickswitch-light"; a simple Q button that doesn't switch to the last weapon you held, but instead always switches to your primary weapon, or, if you already have your primary out, to your melee:

alias weapon1 	    "slot1; r_drawviewmodel 0; alias quickswitch weapon3"
alias weapon2 	    "slot2; r_drawviewmodel 1; alias quickswitch weapon1"
alias weapon3 	    "slot3: r_drawviewmodel 1; alias quickswitch weapon1"
alias quickswitch   "weapon1"
bind 1 		    "weapon1"
bind 2 		    "weapon2"
bind 3 		    "weapon3"
bind q 		    "quickswitch"

The reason this is a lot easier than using the actual Q "lastinv" function, is because the script does not need to keep track of the weapon you were previously holding.

3. Basics of class specific viewmodels

As you could see from the example above, and as you'll see a lot more, if you keep scrolling down, I'm trying to use aliases with clear names that can be copied to class-configs and edited to behave differently for different classes. In order to maintain structure, however, I would recommend against also copying the binds. Whenever I write code, I make sure to put all of my binds in the same place, so that I can easily change them. Read this for more info on keeping an overview of your configs, and to get an insight as to why "nested binds" are a bad idea.

This is what I would do, using the example code above, if I wanted my scout to have an invisible melee weapon, and all my other classes to have invisible primary weapons.

Autoexec.cfg:

// Aliases also defined in class configs (scout and reset).
alias weapon1 	    "slot1; r_drawviewmodel 0; alias quickswitch weapon3"
alias weapon2 	    "slot2; r_drawviewmodel 1; alias quickswitch weapon1"
alias weapon3 	    "slot3: r_drawviewmodel 1; alias quickswitch weapon1"
alias quickswitch   "weapon1"
bind 1 		    "weapon1"
bind 2 		    "weapon2"
bind 3 		    "weapon3"
bind q 		    "quickswitch"

Scout.cfg:

alias weapon1 	"slot1; r_drawviewmodel 1; alias quickswitch weapon3"
alias weapon2 	"slot2; r_drawviewmodel 1; alias quickswitch weapon1"
alias weapon3 	"slot3: r_drawviewmodel 0; alias quickswitch weapon1"

Reset.cfg:

alias weapon1 	"slot1; r_drawviewmodel 0; alias quickswitch weapon3"
alias weapon2 	"slot2; r_drawviewmodel 1; alias quickswitch weapon1"
alias weapon3 	"slot3: r_drawviewmodel 1; alias quickswitch weapon1"

At this point I want to mention a few more things. First of all, I added in a simple comment in my autoexec, that essentially says that if I want to edit those aliases, I also have to do so in the class/ reset configs. Second of all, I added the aliases in more places than necessary (they don't need to be in the autoexec, if they're in the reset.cfg, for example); this is personal preference, I like having an overview of everything in my autoexec.

4. Adding scrollwheel and Q options

If you want to add the option to switch weapons with the scrollwheel (invprev/ invnext) or Q (lastinv), but still have the viewmodels update accordingly, you'll have to do something like this.

4.1 Scrollwheel:

alias weapon1 	"slot1; r_drawviewmodel 0; alias next_weapon weapon2; alias prev_weapon weapon3"
alias weapon2 	"slot2; r_drawviewmodel 1; alias next_weapon weapon3; alias prev_weapon weapon1"
alias weapon3 	"slot3; r_drawviewmodel 1; alias next_weapon weapon1; alias prev_weapon weapon2"
bind 1 		"weapon1"
bind 2 		"weapon2"
bind 3 		"weapon3"
bind mwheelup	"prev_weapon"
bind mwheeldown "next_weapon"

This one should be pretty easy to understand. Every time we switch to a new weapon, the aliases for next/ previous weapon are updated as well.

4.2 Q lastinv:

alias weapon1 "slot1; r_drawviewmodel 0; set_last; alias set_last alias last_weapon weapon1"
alias weapon2 "slot2; r_drawviewmodel 1; set_last; alias set_last alias last_weapon weapon2"
alias weapon3 "slot3; r_drawviewmodel 1; set_last; alias set_last alias last_weapon weapon3"
bind 1 	      "weapon1"
bind 2 	      "weapon2"
bind 3 	      "weapon3"
bind Q 	      "last_weapon"

This one might be a bit harder to understand. Essentially, we make an alias set_last which updates the quickswitch alias to the current weapon.

Since we also call set_last before we update its value, the quickswitch alias is still set to call the previous weapon.

4.3 Adding them together; Scrollwheel and Q lastinv:

alias weapon1   "slot1; r_drawviewmodel 0; alias next_weapon weapon2; alias prev_weapon weapon3; set_last; alias set_last alias last_weapon weapon1"
alias weapon2   "slot2; r_drawviewmodel 1; alias next_weapon weapon3; alias prev_weapon weapon1; set_last; alias set_last alias last_weapon weapon2"
alias weapon3   "slot3; r_drawviewmodel 1; alias next_weapon weapon1; alias prev_weapon weapon2; set_last; alias set_last alias last_weapon weapon3"
bind 1 		"weapon1"
bind 2 		"weapon2"
bind 3 		"weapon3"
bind Q 		"last_weapon"
bind mwheelup	"prev_weapon"
bind mwheeldown "next_weapon"

The script above is what is generally what most people want; it allows almost all of the functions that the game would too, while keeping it very easy to understand and maintain. Obviously we can go well beyond this, to add more options and more customization.

4.4 Special case: slot4 and slot5 (for engineer and spy)

To avoid making your life unnecessarily hard, I would personally advise against incorporating slot4 and slot5 in these scripts. I would recommend to just use separate buttons for these special cases. If, however, you really want to be able to use them with scrollwheel/ Q, you could do extend the cycle for your engineer.cfg, for example, like this:

Autoexec.cfg:

alias weapon1   "slot1; r_drawviewmodel 0; alias next_weapon weapon2; alias prev_weapon weapon3; set_last; alias set_last alias last_weapon weapon1"
alias weapon2   "slot2; r_drawviewmodel 1; alias next_weapon weapon3; alias prev_weapon weapon1; set_last; alias set_last alias last_weapon weapon2"
alias weapon3   "slot3; r_drawviewmodel 1; alias next_weapon weapon1; alias prev_weapon weapon2; set_last; alias set_last alias last_weapon weapon3"
alias weapon4   "slot4"
alias weapon5   "slot5"
bind 1 		"weapon1"
bind 2 		"weapon2"
bind 3 		"weapon3"
bind 4 		"weapon4"
bind 5 		"weapon5"
bind Q 		"last_weapon"
bind mwheelup	"prev_weapon"
bind mwheeldown "next_weapon"

Engineer.cfg:

alias weapon1   "slot1; r_drawviewmodel 0; alias next_weapon weapon2; alias prev_weapon weapon5; set_last; alias set_last alias last_weapon weapon1"
alias weapon2   "slot2; r_drawviewmodel 1; alias next_weapon weapon3; alias prev_weapon weapon1; set_last; alias set_last alias last_weapon weapon2"
alias weapon3   "slot3; r_drawviewmodel 1; alias next_weapon weapon4; alias prev_weapon weapon2; set_last; alias set_last alias last_weapon weapon3"
alias weapon4   "slot4; r_drawviewmodel 1; alias next_weapon weapon5; alias prev_weapon weapon3; set_last; alias set_last alias last_weapon weapon4"
alias weapon5   "slot5; r_drawviewmodel 1; alias next_weapon weapon1; alias prev_weapon weapon4; set_last; alias set_last alias last_weapon weapon5"

Reset.cfg:

alias weapon1   "slot1; r_drawviewmodel 0; alias next_weapon weapon2; alias prev_weapon weapon3; set_last; alias set_last alias last_weapon weapon1"
alias weapon2   "slot2; r_drawviewmodel 1; alias next_weapon weapon3; alias prev_weapon weapon1; set_last; alias set_last alias last_weapon weapon2"
alias weapon3   "slot3; r_drawviewmodel 1; alias next_weapon weapon1; alias prev_weapon weapon2; set_last; alias set_last alias last_weapon weapon3"
alias weapon4   "slot4"
alias weapon5   "slot5"

Note: again, I avoided putting binds in files other than autoexec.

5. The sky is the limit

Like I said, you can take this as far as you want. Personally, I use a script that allows me to toggle any weapon on/ off, while the script remembers that setting, for that weapon slot. Here's how I hide slot-specific viewmodels on the fly.

Honorable mentions

1. Transparent viewmodels

Obviously, scripting isn't the only way to get what you want. Luckily, the game makes it possible to edit your HUD to get transparent viewmodels, so you never have to choose between off and on. Read more here.

2. TF2-EasyScript

If all of this seems really complex to you, have a look at EasyScript. /u/FanciestBanana wrote this really nice API a while back, that is meant to make a lot of scripts, that would otherwise require a lot of code, very simple. Check it out on GitHub and Reddit. And more specifically, the "EasyScript" way of writing slot-aware viewmodel changers.

3. The Scripting community

A good place to start, if you have any additional questions, are the scripting subreddits:

r/TF2Scripts is where people can ask for scripts, or post their own.

r/TF2Scripthelp is a place that is more oriented at helping people learn to script.


r/Tf2Scripts • • Sep 13 '18

Script RootSpy 1.0 cfg is OUT!

17 Upvotes

After months of hard work, I'm very proud to announce my newly scripted mega spy cfg: RootSpy!

It has taken me a very very long time to write it whole, and it includes a variety of completely new, never before seen scripts!

Let's start with the boring stuff:

  • Press W A S D to move. (Duh). Includes a nullmove script, hopefully you all know what that is.

  • Scroll up for revolver, scroll down for knife, press the mousewheel for the disguise kit.

  • Press spacebar to crouchjump.

  • Press Q to crouch.

  • Press R to undisguise.

  • Press MOUSE4 to sap.

  • Every time your sapper is out, sapping will result in a team chat alert.

  • Press the mousewheel for the disguise kit. (I don't reccomend using it to disguise though, I got a much better script for that ;) )

And now for the juicy stuff, get ready. Here are my self developed, newly invented scripts:

  • The stab and sap. Press MOUSE5 to stab with the knife, and release it to automatically start sapping. Very useful in situations where there are a bunch of engineers stacked togheter and you have to get alot done, quicly. Removes the annoying timing factor.

  • Disguise Cycler. To disguise, press 1 (for a medic+medigun disguise), 2 (for a soldier disguise) and 3 (scout disguise, overall best). Press ALT and you will hear a sound and crosshair alert, and it will rebind 1 to a engineer disguise, 2 to a sniper disguise and 3 to a spy disguise. Press ALT again and 1 will be heavy, 2 for demo, 3 for pyro. Press F to toggle friendly disguises.

  • Disguise weapon slot toggler. Here comes the big boy. Your disguise now automatically switches weapons based on the one you have equipped right now! Try to spam the mousewheel around enemies, your disguise will be practically impossible to spot. But then I thought to myself: yeah thats great and all, but running around with your melee out can be really suspicious. That's where I created...

Disguise weapon switcher without slot change. Yes, you heard that right. I really love making new scripts. I think I have a problem! This is extremely useful too though. Press F3 to make your disguise hold out their primary/secondary weapon (you can toggle that with ') WITHOUT actually having to hold out your primary/secondary slot!

EX. I have a soldier disguise. I start scrolling up and down really fast and their medic is instantly convinced. I go for a heavy pick thats in front of me, and the medic sees I slowly approach him with my shovel out. This usually is extremely suspicious behavior! So before he even has the time to process what is actually happening, I press F3 and BOOM! Got my shotgun out. Get the pick and overheal, walk out of the battlefield like the evil mastermind I am.

Enjoy! :)

Here is the link: https://www.dropbox.com/s/b1nydwkpwvpc44f/spy.cfg?dl=0


r/Tf2Scripts • • Aug 30 '12

Script [W]Your crazy ideas [H]The ability to implement (some of) them

17 Upvotes

Surprise me - I've seen many scripts and would like to hear some of the original, interesting ideas that people have. We need to go deeper.. (Please don't suggest simple button re-mappings: they are not interesting or innovative at all). No more requests, please. [mindtrick] This is not the thread you are looking for [/mindtrick]


r/Tf2Scripts • • Apr 07 '12

Script [Script] My Concise Voice Menu Script (Inspired by the concise spy disguise menu)

17 Upvotes

I had the idea of a voice menu that would act like the concise disguise menu for spies: pushing more buttons, but requiring less dancing around the keyboard.

Here is what I came up with

Edit: This has since been updated. I found a bug which is now fixed.

It's still compatible with the traditional 2-key method using numbers so you don't have to worry about it messing up your muscle memory with certain voice commands. It works almost exactly like the concise disguise menu. Start your selection with either z x or c like normal. The corresponding voice menu will pop up. z x and c are now bound to three sections of that voice menu; press z for selections 1-3, x for selections 4-6, and c for 7, 8 and cancel. When you make your selection here, once again those three keys are re-bound, this time to the voice menu commands in the selected parent thread. When you make your final selection the voice command will be initiated, the voice menu will close, and everything will be bound to their initial state.

It may take some while to get used to, but eventually you will find yourself memorizing certain commands based on their "sequence". I might put up a list of useful voice command codes sometime later.

ENJOY! :D


r/Tf2Scripts • • Mar 22 '21

Script Use all vaccinator uber resistances on one target

16 Upvotes

bind "shift" "+attack2;+reload;+attack2;+reload;+attack2;+reload;wait 5;-attack2;-reload;-attack2;-reload;-attack2;-reload"


r/Tf2Scripts • • Sep 04 '20

Resource scalu: A programming language for configuration files

16 Upvotes

Hey everyone!

A while ago, I made a post about implementing arithmetic into the scripting system. I've been iterating on it since then, and its come quite a ways.

scalu is a stand-alone event based programming language written in Python, with support for 8-bit arithmetic, if-else control flow, recursion, printing variables to console, sandboxing, and automatic generation and management of binds and special files (classes, autoexec, listenserver, etc), that all compiles down to a single cfg file. The language is semantically as expressive as config files alone, which means that almost all programs that can be expressed with regular configuration files can also be expressed in scalu, but usually much more easily.

The source code as well as examples can be found on the Github: https://github.com/ArgosOfIthica/scalu. Examples currently include a "perfect" weapon state script (tracks all classes), as well as the classic null movement script. There's also a small wiki: https://github.com/ArgosOfIthica/scalu/wiki

I've also created a repl for those who want to try it out in their browser, though obviously having the compiler locally is a far superior experience. Edit the program string, then hit "run" to compile a text based config.

Its also worth noting this will work for most source games. Nothing about this compiler is actually specific to TF2. A lot of testing was done in Half-Life: Source, for instance. The only assumption it makes is that the config system has bind , alias and other basic Quake-like syntax.


r/Tf2Scripts • • Aug 28 '18

Resolved TF2 sniper hold mouse 2 to zoom let go to zoom out pls help

16 Upvotes

Oh my god I have been searching for 3 days on the internet and I have found nothing. You would think that even one person would have scripted for this, but so far NOTHING. I don't want anything for crouching, nor "one sniper button". Please just give me a script that will allow me to zoom in and out with sniper by holding and letting go of mouse 2 button.

Also preferably one without the wait command, as it isn't supported on quite a few valve servers. Whoever does it will get the satisfaction of helping a f2p player pls help me I beg for assistance.


r/Tf2Scripts • • Sep 22 '22

Script Tic tac toe script with “AI”

15 Upvotes

r/Tf2Scripts • • Mar 07 '12

Script My Numpad class switcher Keybinds (x-post from r/truetf2)

Thumbnail
reddit.com
15 Upvotes

r/Tf2Scripts • • Apr 30 '24

Script Demoknight script to increase control while charge turning

14 Upvotes

Intro:

I rewatched SolarLight's 'Demoknight's charge is complicated' video and wanted to solve the inconsistency of 'Ali Baba's Wee Booties' between players, and the underutilization of the bonus turn control. In the video, he recommends binding Q and E keys for +left and +right to solve this.

This script lets you use the A and D keys for +left and +right, and sets A and D back to normal when you're not charging. I chose these keys because strafing does not work while charging, so they would otherwise be useless during a charge.

Ultimately, I have been able to turn 2-3x more effectively and iron out the bugs so it feels smooth.

I have also integrated the script with a null-movement script.

Limitations:

Very occasionally for a split second, you may experience +left (like looking left with a joystick) when trying to strafe after a charge. but if you press the inputs outlined in the next sentence, it is not an issue.

I cannot perfectly set the timing of A and D returning to normal when the charge ends, so it changed to normal upon most other inputs: such as left click, jump, duck and W&D inputs.

I found that I had to break my habit of unnecessarily holding/pressing certain keys while charging, so the script could accurately guess when I had stopped charging, and so that I could pilot the charge properly.

Modifying:

If you'd like to add more or remove some of the 'checks' that tell the script if you're charging, add or remove chargeOff as you desire.

How to Use:

Use the same way you would airstrafe: for example, to strafe left while charging, hold A and steer your mouse left.

The Script:
(last edit 2026, the script's F8 toggle on the previous version was broken for like a year lol)

only bug remaining is that holding a/d during end of charge does not translate automatically into strafing left/right. couldn't figure it out but its a very small deal

cl_yawspeed 100 // playing around with different values, it feels like it changes nothing?
 
cl_yawspeed 100 // playing around with different values, it feels like it changes nothing?
 
bind F8 chargeScriptToggle // change f8 to your preffered key to toggle the script on and off.
alias chargeScriptToggle chargeStrafeScriptDisabled
alias chargeStrafeScriptEnabled  "alias chargeScriptToggle chargeStrafeScriptDisabled; alias chargeToggle chargeOn; alias +chargeOffCheckingLeft isLeftCheck; alias +chargeOffCheckingRight isRightCheck; echo chargeStrafeScriptEnabled"
alias chargeStrafeScriptDisabled "alias chargeScriptToggle chargeStrafeScriptEnabled; alias chargeToggle chargeOff; chargeOff; alias +chargeOffCheckingLeft; alias +chargeOffCheckingRight; echo chargeStrafeScriptDisabled"
chargeScriptToggle


bind MOUSE1 +m1key
bind MOUSE2 +m2key
 
alias +m1key "chargeOff; +attack; spec_next"
alias -m1key "-attack"
 
alias +m2key "+attack2; +m2keyExtra; spec_prev"
alias -m2key "-attack2"
 
alias +m2keyExtra chargeToggle
 
alias chargeOn  "bind a +goLeft; bind d +goRight;-mleft; -mright; echo chargeOn; +chargeOffCheckingLeft; +chargeOffCheckingRight; alias isLeftCheck; alias isRightCheck"
alias chargeOff "bind a +akey; bind d +dkey; -left; -right;checkStrafe" 
 
 
 
 
 
alias chargeToggle chargeOn
 
alias isLeftCheck
alias isRightCheck
alias checkStrafe
 
 
 
 
alias +goRight  "+right; alias checkStrafe +mright"
alias -goRight "-right; alias checkStrafe"
alias +goLeft   "+left; alias checkStrafe +mleft"
alias -goLeft "-left; alias checkStrafe"
 
 
alias +chargeOffCheckingLeft
alias -chargeOffCheckingLeft
alias +chargeOffCheckingRight
alias -chargeOffCheckingRight
 
 
 
bind W +wkey
bind S +skey
bind A +akey
bind D +dkey
 
alias +wkey "+mfwd; chargeOff"
alias +skey "+mback; chargeOff"
alias +akey "+mleft; chargeOff; alias isLeftCheck +goLeft; alias checkStrafe +mleft"
alias +dkey "+mright; chargeOff; alias isRightCheck +goRight; alias checkStrafe +mright"
alias -wkey -mfwd
alias -skey -mback
alias -akey "-mleft; alias checkStrafe; chargeOff; alias isLeftCheck"
alias -dkey "-mright; alias checkStrafe; chargeOff; alias isRightCheck"
 
 
alias +mfwd "-back; +forward; alias checkfwd +forward"
alias +mback "-forward; +back; alias checkback +back"
alias +mleft "-moveright; +moveleft; alias checkleft +moveleft"
alias +mright "-moveleft; +moveright; alias checkright +moveright"
alias -mfwd "-forward; checkback; alias checkfwd"
alias -mback "-back; checkfwd; alias checkback; chargeOff"
alias -mleft "-moveleft; checkright; alias checkleft"
alias -mright "-moveright; checkleft; alias checkright"
 
alias checkback
alias checkfwd
alias checkleft
alias checkright
 
bind SPACE +spacekey
bind CTRL +ctrlkey
 
alias +spacekey "+jump; chargeOff"
alias -spacekey -jump
alias +ctrlkey "+duck; chargeOff"
alias -ctrlkey -duck
 
chargeStrafeScriptDisabled

r/Tf2Scripts • • Jul 26 '22

Script Conway's Game of Life script

14 Upvotes

I wrote a script that runs Conway's Game of Life in the console! I like this one more than the brainfuck interpreter since it it easier to play around with, and I had more fun writing it. There is some overlap between the techniques used in them though, so I'm glad I did this one with the brainfuck knowledge.

Anyways, if anyone has any questions, comments or suggestions on how to make the script or its documentation better, I would love to hear them!

Repo: https://github.com/MrShwhale/source-GoL


r/Tf2Scripts • • Jan 08 '22

Question Any ideas as to what would be causing this shadows to glitch on the rocks?

14 Upvotes

r/Tf2Scripts • • Oct 20 '20

I put it so if i press mouse2 it says uber popped in chat to my team, but when i switch to another class like hybrid knight evertime i charge it says that in chat, how to fix, i use master config and i put that in my medic.cfg

14 Upvotes

r/Tf2Scripts • • Sep 12 '20

Resource Statistics tracking with setinfo, incrementvar/multvar, and con_logfile.

14 Upvotes

Using setinfo and incrementvar, you can make a custom stat for something. In the example below is a script that records how many times I pushed w.

setinfo forward_push_count 0
bind w +sforward
alias +sforward "+forward; incrementvar forward_push_count 0 10000000000 1"
alias -sforward "-forward"

Now by setting con_logfile before displaying the convar, you can make a basic statistic record. Now going back to the forward example, lets record how many times w was pushed, and the lengths of how long it was pushed.

setinfo forward_push_count 0
setinfo forward_push_length 0
alias r_sloop "incrementvar forward_push_length 0 10000000 1; wait 1; sloop"
bind w +sforward
alias +sforward "+forward; incrementvar forward_push_count 0 100000000 1; alias sloop r_sloop; sloop"
alias -sforward "-forward; con_logfile wpushed.log; forward_push_count; forward_push_length; con_logfile console.log; forward_push_length 0; alias sloop ;"

After running this script and playing 1 game, it would ideally produce something like this:

"forward_push_count" = "1"
 - Custom user info value
"forward_push_length" = "214"
 - Custom user info value
"forward_push_count" = "2"
 - Custom user info value
"forward_push_length" = "123"
 - Custom user info value
"forward_push_count" = "3"
 - Custom user info value
"forward_push_length" = "532"
 - Custom user info value
"forward_push_count" = "4"
 - Custom user info value
"forward_push_length" = "653"
 - Custom user info value
"forward_push_count" = "5"
 - Custom user info value
"forward_push_length" = "231"
 - Custom user info value
"forward_push_count" = "6"
 - Custom user info value
"forward_push_length" = "123"
 - Custom user info value

I don't see how much use multvar could be in this situation, but you could use it to half the count in case what it counts is a toggle. E.g half the cloak counter to account for uncloaks. Overall, nothing of much value here, just wanted to give ideas and find a reason to use setinfo.

P.S Would be great if there was an other tag.


r/Tf2Scripts • • Aug 04 '17

Script Bringing scripts to mainstream: TF2-EasyScript

14 Upvotes

I come here to share with you a stupidly complex script API to address all your scripting needs:
GitHub link
GitLab link

If you ever wrote script, you know that they require a lot of ground work. Well, I've done it for you, all of it, I mean it. Everything you ever wanted is just a few lines of code. Weapon specific FOV, quickbuild, trahstalking? Anything has become easier with TF2-EasyScriptTM (former ultimate framework).

I will stop fanfares here since i already did that in readme. My idea behind this script is to provides lots of utlities for scrpting like stable frontend and short-hand aliases for every in-game function. This means sharing your scripts is also easier, since very little modification should be ever required.

PS. Even if you don't really need or understand it, just please appreciate that a dude on the internet spent moths on creating a programming language and a compiler to create 94kb script to make writing other scripts easier for a videogame. I need some validation.


r/Tf2Scripts • • Jun 22 '14

Script The Ultimate STFU script

14 Upvotes

This script removes chat messages and mutes everyone on the server. Doesn't mess with voulmes. And you can toggle it. Simple, but effective.

//stfu script
bind key stfu
alias stfu stfu1
alias stfu1 "hud_saytext_time 0; voice_modenable 0; echo Voice/Chat OFF; alias stfu stfu2"
alias stfu2 "hud_saytext_time 12; voice_modenable 1; echo Voice/Chat ON; alias stfu stfu1"

As allways, replace "key" with your desired key. Credit goes to Burnfingers on GameBanana


r/Tf2Scripts • • Apr 17 '13

Resource cfg#: a syntax highlighter for tf2 scripting

14 Upvotes

DOWNLOAD LINK HAS BEEN FIXED

original thread

Current Version: 1.1


What it does:

Using a syntax highlighter will change how certain text is displayed.

cfg# changes commonly used commands to improve readability.

Instead of this, it will look like this.

This is a big help when dealing with complicated scripts, as it becomes hard to distinguish between different multiple aliases, comments, etc.

Another example of it in use


Installation:

This works best with Notepad++. If you don't have it already, get it from here.

First extract the cfg#.zip to an easily accessible place.

Next, open up a file with notepad++ and then click on "Define your language..." under the "Language" tab. Click "Import..." and then navigate to the cfg#.xml file in folder extracted from cfg#.zip. You should get a message saying "Import Successful." Finally, restart Notepad++

Using cfg#:


To view a file with cfg# highlighting, open up a file and click on "cfg#" in the "Language" dropdown.


Download cfg# VERSION 1.1 HERE


r/Tf2Scripts • • Feb 14 '21

Request Vaccinator Quick-switch resistance script.

13 Upvotes

Hi! I've been wanting a Vaccinator quick-switch script lately, however, I cannot use the ones online due to the fact that I play on a laptop with a trackpad. I cannot use scroll to switch weapons, and rely on the num row. Furthermore I've also rebound several keys around my left hand such as E to M1.

I was wondering if someone could make a script that would allow me to quickswitch between resists using a combination of keys such as Shift+1 being Bullet, Shift+2 being Explosive and Shift+3 being Fire, similar to my Eureka Effect teleport bind.

Thanks in advance!


r/Tf2Scripts • • Oct 24 '20

Script First (even slightly complex )config, I made a consistent Medic last wep swap bind. What do you think?

13 Upvotes
/////////////////////
//Quickswitch Bind//
///////////////////
	//Aliases//
	//////////
	alias equipXbow "slot1; back2healz;"
	alias equipHealz "slot2; back2xbow;"
	alias equipSaw "slot3; back2xbow;"
	alias back2xbow "bind q equipXbow"
	alias back2healz "bind q equipHealz"
	alias back2saw "bind q equipSaw"
	////////////////////////////////////
	//Binds//
	////////
	bind 1 "equipXbow"
	bind 2 "equipHealz"
	bind 3 "equipSaw"
	bind q "equipHealz"
	bind g "lastinv" //exits tauntmenu, use your own key, my taunt key is SHIFT
	////////////////////////////////////

Instead of the normal last weapon button, this one changes to a specific weapon depending on which weapon you currently have equipped, here's a cheatsheet of which slot switches back to which weapon:

Crossbow/Syringe Gun => Medi Gun

Medi Gun => Crossbow/Syringe Gun

Saw => Crossbow/Syringe Gun

The purpose of this tool is to make sure that Q will always swap between your primary/secondary (to get a quick crossbow shot) even after you've engaged in melee combat. You'll not be able to close the tauntmenu through the default bind, however. Also, I'd imagine using the mousewheel to change your weapons will break it.

What do you think of this? It's my first script for TF2 that I've ever written that isn't a simple bind <key> *lennyface* piece of crap.

EDIT: after someone requested, i wrote a script for Spy.

/////////////////////
//Quickswitch Bind//
///////////////////
	//Aliases//
	//////////
	alias equipRev "slot1; back2Knife;"
	alias equipSap "slot2; back2Knife;"
	alias equipKnife "slot3; back2Rev;"
	alias equiplungcancer "slot4; back2Knife;"
	alias back2Rev "bind Q equipRev"
	alias back2Sap "bind Q equipSap"
	alias back2Knife "bind Q equipKnife"
	////////////////////////////////////
	//Binds//
	////////
	bind 1 "equipRev"
	bind 2 "equipSap"
	bind 3 "equipKnife"
	bind 4 "equiplungcancer"
	bind Q "equipKnife"
	bind g "lastinv" //exits tauntmenu, use your own key, my taunt key is SHIFT
	////////////////////////////////////

EDIT2: 1 minute after the last edit, here is my engineer.cfg. Note that I use Uncle Dane's Quickbuild binds for buildings, IDK if it works with the defaults, I assume it would since spy did. I highly recommend you switch to the new binds though! It's a bitch at the start, but you'll thank me once you start doing that. Also, if you don't know who Dane is, he makes excellent engineer videos on YT, if you want to get better. My binds are made to be played on my fucking strange key layout though, so try changing them to see what fits you.

//////////////////////////
//Sentry Quickbuild Bind//
//////////////////////////
bind "MOUSE4" "destroy 2 0; build 2 0"
//////////////////////////////////////

/////////////////////////////
//Dispenser Quickbuild Bind//
/////////////////////////////
bind "MOUSE3" "destroy 0 0; build 0 0"
/////////////////////////////////

///////////////////////////////////////
//Teleporter Entrance Quickbuild Bind//
///////////////////////////////////////
bind "4" "destroy 1 0; build 1 0"
/////////////////////////////////

///////////////////////////////////
//Teleporter Exit Quickbuild Bind//
///////////////////////////////////
bind "CTRL" "destroy 1 1; build 1 1"
/////////////////////////////////

/////////////////////
//Quickswitch Bind//
///////////////////
	//Aliases//
	//////////
	alias equipSG "slot1; back2Bap;"
	alias equipPiss "slot2; back2SG;"
	alias equipBap "slot3; back2SG;"
	alias back2SG "bind Q equipSG"
	alias back2Piss "bind Q equipPiss"
	alias back2Bap "bind Q equipBap"
	////////////////////////////////////
	//Binds//
	////////
	bind 1 "equipSG"
	bind 2 "equipPiss"
	bind 3 "equipBap"
	bind Q "equipBap"
	bind g "lastinv" //exits tauntmenu, use your own key, my taunt key is SHIFT
	////////////////////////////////////