Left 4 Dead 2

Left 4 Dead 2

D_Tor's Additional Melee Slot
Lord_Manship 18 Jun, 2018 @ 4:27pm
Bind Toggle script
I noticed that having to reach over to the 7 key was tiresome, so I created this script to toggle between slot2 and slot7. Put it in the autoexec.cfg file in your game's script directory. (Typically this is in "C:\Program Files (x86)\Steam\steamapps\common\Left 4 Dead 2\left4dead2\cfg" on Windows.) You can find your game's directory by right clicking on Left 4 Dead 2 in your Steam Library, going to the "Manage" sub-menu, and selecting "Browse local files". Then, open the "cfg" folder. If there is no "autoexec.cfg" file, you can create a text file and rename it to "autoexec.cfg". One way of doing this is to open Windows Notepad, selecting "Save As..." in the File menu, and then select "All Files" under the "Save as type" dropdown. Then proceed to save the file as "autoexec.cfg" in the "cfg" directory described earlier. You can now copy and paste the code shown below into Notepad, and save the file.

bind 2 toggle alias toggle "enable" alias enable "alias toggle disable; slot2" alias disable "alias toggle enable; slot7"

This script was taken directly from the TF2 Wiki.
(No, this is not going to get you VAC banned, scripts like these are not considered hacking. See the top of the scripting page on the TF2 Wiki for the same explanation.)

EDIT: Hey, so this exact same script is in the orignal's mod's description as well. So there you go.
Last edited by Lord_Manship; 15 Oct, 2024 @ 6:44pm
< >
Showing 1-7 of 7 comments
T626 15 Oct, 2024 @ 3:12pm 
@Lord_Manship I'm currently subscribed to @Dr. Tobias's version of this mod. But the thing that I still want to know is how can I change the bind toggle of the additional melee slot of this mod (either ♥ D_Tor ♥"s or Dr. Tobias') to number 6 on the keyboard instead of slot 7??
Lord_Manship 15 Oct, 2024 @ 6:33pm 
Originally posted by T626:
@Lord_Manship I'm currently subscribed to @Dr. Tobias's version of this mod. But the thing that I still want to know is how can I change the bind toggle of the additional melee slot of this mod (either ♥ D_Tor ♥"s or Dr. Tobias') to number 6 on the keyboard instead of slot 7??
You can simply change the slot it toggles to.
For example:
bind 2 toggle alias toggle "enable" alias enable "alias toggle disable; slot2" alias disable "alias toggle enable; slot6" // Select slot6 instead of slot7.
If you wish to change which key is the toggle key, update the bind command. For example, this binds the toggle to the 6 key on the number row:
bind 6 toggle // Bind to the 6 key instead of the 2 key. alias toggle "enable" alias enable "alias toggle disable; slot2" alias disable "alias toggle enable; slot6" // Select slot6 instead of slot7
See the TF2 Wiki for the names of every key accepted by the bind command. Hover over the keys with your mouse to get the name.
In conclusion, either change the key name in the bind command, or the slot number at the end of the enable or disable aliases.
Last edited by Lord_Manship; 15 Oct, 2024 @ 6:34pm
T626 17 Oct, 2024 @ 8:53am 
Originally posted by Lord_Manship:
Originally posted by T626:
@Lord_Manship I'm currently subscribed to @Dr. Tobias's version of this mod. But the thing that I still want to know is how can I change the bind toggle of the additional melee slot of this mod (either ♥ D_Tor ♥"s or Dr. Tobias') to number 6 on the keyboard instead of slot 7??
You can simply change the slot it toggles to.
For example:
bind 2 toggle alias toggle "enable" alias enable "alias toggle disable; slot2" alias disable "alias toggle enable; slot6" // Select slot6 instead of slot7.
If you wish to change which key is the toggle key, update the bind command. For example, this binds the toggle to the 6 key on the number row:
bind 6 toggle // Bind to the 6 key instead of the 2 key. alias toggle "enable" alias enable "alias toggle disable; slot2" alias disable "alias toggle enable; slot6" // Select slot6 instead of slot7
See the TF2 Wiki for the names of every key accepted by the bind command. Hover over the keys with your mouse to get the name.
In conclusion, either change the key name in the bind command, or the slot number at the end of the enable or disable aliases.

Okay. I just copied and pasted
bind 6 toggle // Bind to the 6 key instead of the 2 key.
alias toggle "enable"
alias enable "alias toggle disable; slot2"
alias disable "alias toggle enable; slot6" // Select slot6 instead of slot7

and put it in my autoexec.cfg underneath "// Active Key binds". Did I do the right thing, @Lord_Manship?
T626 17 Oct, 2024 @ 10:03am 
@Lord_Manship I just tested it out on No Mercy; it didn't work. When I pressed slot 6, it just switched to my secondary pistol instead of to the melee weapon that I had picked up. I still had to press 7 to switch to my melee weapon.
Lord_Manship 17 Oct, 2024 @ 11:59am 
It's a toggle, so you may need to press it twice based on which state it's in to get the desired weapon. Add me as a friend, and I can try to help you out.
AbyssalThighs 8 Nov, 2024 @ 10:03pm 
Sorry to bother if this is an old thread.
But I would just like to ask for help.
The script works but I had to console command it everytime.
I tried putting it throught autoexec.cfg but it just disables my "2" button
here's the only content in my autoexec.cfg

//Binds

bind 2 toggle
alias toggle "enable"
alias enable "alias toggle disable; slot2"
alias disable "alias toggle enable; slot7"

---
TIA
Lord_Manship 10 Nov, 2024 @ 2:10pm 
Originally posted by AbyssalThighs:
Sorry to bother if this is an old thread.
But I would just like to ask for help.
The script works but I had to console command it everytime.
I tried putting it throught autoexec.cfg but it just disables my "2" button
here's the only content in my autoexec.cfg

//Binds

bind 2 toggle
alias toggle "enable"
alias enable "alias toggle disable; slot2"
alias disable "alias toggle enable; slot7"

---
TIA
It might be because it's a toggle, you'll need to press it twice to get to the desired weapon. Otherwise, if it still doesn't work, add me as a friend, and I can try to work it out with you.
< >
Showing 1-7 of 7 comments
Per page: 1530 50