I have tried many of the suggestions here but I cant seem to get any to work. I am trying to make my middle mouse button a toggle for crouch. I'm sick of holding it down. so far the 3 scrips I have ried did not work.
toggle crouch for bf2142
Started by
zenuke
, Jan 25 2007 02:20 AM
12 replies to this topic
#1
-
Posted 25 January 2007 - 02:20 AM
If you want to not hold anything dow may i suggest scroll lock or Caps lock or Num Lock
because you will need to hold down middle mouse button
because you will need to hold down middle mouse button
#2
-
Posted 25 January 2007 - 03:53 AM
No you don't. You can send a {Key down}, and then a {Key up} later on.
@zenuke: You need to be more specific about what has to be done to crouch. Most importantly, the key that actually does it.
@zenuke: You need to be more specific about what has to be done to crouch. Most importantly, the key that actually does it.
#3
-
Posted 25 January 2007 - 04:13 AM
I don't use this anymore but it works. The trigger is a double tap of control to initiate a toggle crouch, an ordinary press works as a press and hold crouch. Just crouch and release to toggle off crouch.
~LCtrl up:: ;use LCtrl "up" so it doesn't get triggered when you hold ctrl Goto, Crouch Crouch: ; Changed: Trigger was changed to "~LCtrl" as ~ allows normal operation of key. If (a_tickCount-lasttime < 400) ;Check when we released ctrl the last time if < 400ms initiate Crouch { Loop { Send, {LCtrl down} ; Initiate 'Crouch' If IsKeyPressed("LCtrl") ; Check if 'LCtrl' pressed. If pressed & released, Break loop. Send, {LCtrl up} ; Release 'Crouch' Break } } lasttime:=a_tickCount Return IsKeyPressed(v_KeyName) ; Returns 1 if %v_KeyName% is currently being pressed, otherwise 0 { GetKeyState, state, %v_KeyName%, P If state = D ; The key has been pressed { Return 1 } Return 0 }
#4
-
Posted 29 January 2007 - 10:21 AM
I use the middle mouse button in the game as the crouch action. You normally need to hold down whatever key you have set in order to stay crouched. I would like to eliminate having to hold the button down.
If I can click the middle button and have it act as if its being held down, thats what I want. When I click the button again, it acts as if I let go.
the things I've tried do not work. I end up not being able to crouch at all.
If I can click the middle button and have it act as if its being held down, thats what I want. When I click the button again, it acts as if I let go.
the things I've tried do not work. I end up not being able to crouch at all.
#5
-
Posted 29 January 2007 - 03:39 PM
MButton:: If not D { Send, {Click down middle} D=1 } Else { Send, {Click up middle} D=0 } Return
#6
-
Posted 29 January 2007 - 04:09 PM
YMP i'll give that a try but it looks very similar to something I've already tried. I'll let you know how it goes later.
#7
-
Posted 29 January 2007 - 04:17 PM
didnt work, same thing happened as other scripts. I click once and nothing happens. I could still duck with this one by holding the key down.
#8
-
Posted 29 January 2007 - 11:10 PM
This looks like the game intercepts mouse events, so that they are invisible to AutoHotkey; therefore the code for MButton is never run.I could still duck with this one by holding the key down.
You can try another method of the middle click detection:
Loop { KeyWait, MButton, D KeyWait, MButton Send, {Click down middle} SoundBeep KeyWait, MButton, D KeyWait, MButton Send, {Click up middle} SoundBeep SoundBeep }Also SendPlay may be better instead of Send. I inserted SoundBeeps into the code so that you can hear if AutoHotkey sees you press the button.
#9
-
Posted 30 January 2007 - 05:12 AM
BF2Enhance works with BF2142.
Crouch Toggle, Quick Weapon Switch, Quick Weapon Scroll, Iron Sights, Enable Paste.
*Oh and for crouch toggle....
Crouch Toggle, Quick Weapon Switch, Quick Weapon Scroll, Iron Sights, Enable Paste.
*Oh and for crouch toggle....
state=up SetKeyDelay, -1, 100 Hotkey, {KEY} , Run return Run: if state = up { Send, {KEY down} state=down } else { Send, {KEY up} state=up } return
#10
-
Posted 30 January 2007 - 02:39 PM
Is the same exact thing as~LCtrl up:: ;use LCtrl "up" so it doesn't get triggered when you hold ctrl Goto, Crouch Crouch: ; Changed: Trigger was changed to "~LCtrl" as ~ allows normal operation of key. If (a_tickCount-lasttime < 400) ;Check when we released ctrl the last time if < 400ms initiate Crouch { Loop { Send, {LCtrl down} ; Initiate 'Crouch' If IsKeyPressed("LCtrl") ; Check if 'LCtrl' pressed. If pressed & released, Break loop. Send, {LCtrl up} ; Release 'Crouch' Break } } lasttime:=a_tickCount Return IsKeyPressed(v_KeyName) ; Returns 1 if %v_KeyName% is currently being pressed, otherwise 0 { GetKeyState, state, %v_KeyName%, P If state = D ; The key has been pressed { Return 1 } Return 0 }
~LCtrl up:: If (a_timeSinceThisHotkey < 400) { Send, {LCtrl down} If GetKeyState("LCtrl","P") Send, {LCtrl up} } ReturnDue to the redundant function, redundant Goto, and the loop that doesn't loop.
Sorry for gravedigging, but seeing that code hurt me inside. :cry:
#11
-
Posted 19 March 2011 - 05:22 PM
Just tried your code, nimda, and while it is logically the same, it does NOT do the same thing. It seems that AHK has trouble with a_timeSinceThisHotkey when applied to a tilded hotkey. You will find that if you run your code, it will not release the key when you try to toggle it off.
Keeping a_tickCount makes it work perfectly.
Keeping a_tickCount makes it work perfectly.
~LCtrl up:: If (a_tickCount-lasttime < 300) { Send, {LCtrl down} If GetKeyState("LCtrl", "P") Send, {LCtrl up} } lasttime:=a_tickCount Return
#12
-
Posted 28 April 2011 - 03:39 AM
ok i seriously have to ask, people still play BF 2142? off topic i know but seriously i thought it's community died out, well at least 90% of the australian community went to BC 2 which will all be moving to BF3 within a year or 2 after it's release
#13
-
Posted 28 April 2011 - 06:02 AM