Team Fortress 2

Team Fortress 2

Not enough ratings
scripting - proper slot switcher
By ionice
This is a script to switch weapon slots that doesn't break where most such scripts do.
Taking feedback / requests for entertainment.

The problem:
-> Executing a command string every time you switch to a specific weapon slot.
- Normally pressing Q ( selecting last slot ) will bypass your bind.
- While this is trivial for something like "slot3; voicemenu 1 1; exec say_lenny"
- It is catastrophically obnoxious if you're trying to hide a viewmodel of a specific weapon or +reload only your rocket launcher.
-> So how do you track the last active slot without variables?

The solution:
Have a separate alias per condition ( switching from slots 1,2,3 to slots 1,2,3 )
Have each switch update which slot you'd be switching from for each key / base-alias ( 1,2,3,Q / s1,s2,s3,sL )

The price:
Running 3 alias commands on every slot switch
   
Award
Favorite
Favorited
Unfavorite
Script
-> You have to edit this script - Add commands to ( s[1,2,3]b ) aliases.
-> Keys bound by this script ( 1,2,3,Q )
// last slot alias sL s12 bind q sL // slot1 bind 1 s1 alias s1 s12 alias s12 "alias sL s21; alias s2 s21; alias s3 s31; slot1; s1b" alias s13 "alias sL s31; alias s2 s21; alias s3 s31; slot1; s1b" alias s1b "" // slot2 bind 2 s2 alias s2 s21 alias s21 "alias sL s12; alias s1 s12; alias s3 s32; slot2; s2b" alias s23 "alias sL s32; alias s1 s12; alias s3 s32; slot2; s2b" alias s2b "" // slot3 bind 3 s3 alias s3 s31 alias s31 "alias sL s13; alias s1 s13; alias s2 s23; slot3; s3b" alias s32 "alias sL s23; alias s1 s13; alias s2 s23; slot3; s3b" alias s3b ""
miscellaneous commands
r_drawviewmodel tf_use_min_viewmodels cl_crosshair_[ file / red / green / blue / scale / alpha / color ] [ hud_medicautocallers / hud_medicautocallersthreshold ] tf_viewmodels_offset_override [ 0 0 0 ] viewmodel_fov

more commands at:
https://developer.valvesoftware.com/wiki/List_of_TF2_console_commands_and_variables