Jump to content

Help with recursive script for toggling between weapons with one mouse button


Beeshbum

Recommended Posts

Hello! I've been a long time ET Player, but just now getting back to it after years off. I used to have an autoexec.cfg that I no longer have, so trying to recreate it from memory which makes it a bit hard as I'm a bit rusty. 

 

In my autoexec.cfg, I used to have a script that would toggle a mouse thumb button between weapon 3 and weapon 2. The other mouse thumb button would toggle between weapon 6 and weapon 5. These were MOUSE5 and MOUSE4 buttons. I saw the examples in your tutorials, but I cannot get them to work. (http://fearless-assassins.com/tutorials/article/52-wolfenstein-et-binding/)

 

What I want to happen is, when using the first thumb button on the mouse (MOUSE5), I want it to toggle from main weapon (weapon 3) and go to the handgun (weapon 2) and back and forth each time I click it. Same for MOUSE4, but with weapon 6 and weapon 5.

 

Any help would be greatly appreciated. I've tried a few things and no avail.

 

I've been playing exclusively on your servers (one of the few I've seen without bots!). I'd like to try to regain my competitive form!

  • Like 1
Link to comment
Share on other sites


set weap3 "weaponbank 2; bind mouse5 vstr weap4"

set weap4 "weaponbank 3; bind mouse5 vstr weap3"

bind mouse5  "vstr weap3"

 


set weap1 "weaponbank 5; bind mouse4 vstr weap2"

set weap2 "weaponbank 6; bind mouse4 vstr weap1"

bind mouse4 "vstr weap1"

 

Add those to your config or autoexec. It will change to desired weaponbank when key is 'clicked'

  • Like 2
Link to comment
Share on other sites

Thanks! Works great! Any way to make it default to a particular weapon after something else is clicked? For instance, when I go to weapon 5 and then want to go back to 3 but use the MOUSE5 button, it will sometimes take me to the handgun. I'd prefer to always go to weapon 3 when I exit the "loop".

Link to comment
Share on other sites

Thanks! Works great! Any way to make it default to a particular weapon after something else is clicked? For instance, when I go to weapon 5 and then want to go back to 3 but use the MOUSE5 button, it will sometimes take me to the handgun. I'd prefer to always go to weapon 3 when I exit the "loop".

Just invert weaponbanks in separate scripts so you would always start 'loop' with desired weaponbank. I made those scripts as requested - upon pressed - first pressed key - goes to weaponbank 2 and in other script 5.

Link to comment
Share on other sites

So using this scripts you'll have on key press mouse5 changed weapon to 'weaponbank 2' and on next press on 'weaponbank 3', for mouse4 first press is 'weaponbank 5' and second press is 'weaponbank 6'.

set weap3 "weaponbank 2; bind mouse5 vstr weap4"
set weap4 "weaponbank 3; bind mouse5 vstr weap3"
bind mouse5  "vstr weap3"

set weap1 "weaponbank 5; bind mouse4 vstr weap2"
set weap2 "weaponbank 6; bind mouse4 vstr weap1"
bind mouse4 "vstr weap1"

And using this scripts you'll have on key press mouse5 changed weapon to 'weaponbank 3' and on next press on 'weaponbank 2', for mouse4 first press is 'weaponbank 6' and second press is 'weaponbank 5'. This is what I meant by invert :)

set weap3 "weaponbank 3; bind mouse5 vstr weap4"
set weap4 "weaponbank 2; bind mouse5 vstr weap3"
bind mouse5  "vstr weap3"

set weap1 "weaponbank 6; bind mouse4 vstr weap2"
set weap2 "weaponbank 5; bind mouse4 vstr weap1"
bind mouse4 "vstr weap1"

And as for your request from post #3 . You can't have script that will take you 'sometimes' to pistol and sometimes to other weapons. You can make press and hold script, so when you release key it would return to weaponbank 3 :)

Here is simple example for walk with additional cmds. Works like you press alt - walk1 is executed, you release alt - walk2 is executed.

set walk1	"sensitivity 1.5; +speed"
set walk2	"sensitivity 2; -speed"
bind ALT "+vstr walk1 walk2"
  • Like 1
Link to comment
Share on other sites

I'm sorry, I think you misunderstood my post #3. I don't want a script to sometimes give me a weapon. What I'm saying is currently that is what it does but I always want the script to start me off with weapon3 after I exit the script.

 

Currently, I can toggle main weapon (weapon 3) and handgun (weapon 2) with the script you originally provided. However, when I go to another weapon bank, sometimes the script you gave me will go to handgun first instead of always starting with weapon 3. Is there any way to make it always start with weapon 3 regardless of how the loop was exited? I think I remember my old script working that way.

Link to comment
Share on other sites

  • 3 weeks later...
set weap1 "weaponbank 5; bind mouse4 vstr weap2; bind mouse5 vstr weap4"
set weap2 "weaponbank 6; bind mouse4 vstr weap1"
bind mouse4 "vstr weap1"

set weap3 "weaponbank 2; bind mouse5 vstr weap4"
set weap4 "weaponbank 3; bind mouse5 vstr weap3; bind mouse4 vstr weap1"
bind mouse5  "vstr weap3"

Would this work?

 

(I think I got the way it will loop the correct way around)

 

I think should work, assuming you are using mouse4 and mouse5 to switch weapons. If you ever use the keys it will obviously not work/

Edited by SadElf
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.