Page 1 of 3

Working Crouch Toggle Script

Posted: 2013-07-29 21:46
by smgunsftw
After hours of searching, I've finally found a working crouch-toggle key for Project Reality and BF2. This should help others who suffer fatigue in their fingers due to holding down the crouch key for an extended period of time. Note that this script also works for all other games and applications.

http://www.autohotkey.com/board/topic/1 ... ouch-help/

The Code:

Code: Select all

~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
}
How it works:
Normal crouch is still working as intended
Double-tapping LCtrl causes you to toggle crouch, tap crouch again to get out of toggle-crouch

How to install it:
  1. Download AutoHotkey
  2. Create a new Autohotkey script (Right-click, New>Autohotkey Script)
  3. Copy and paste the script from this post, and save the document
  4. Alternatively, you can download the file from this link https://www.dropbox.com/s/bdgfp8tdyd2pm ... ch%201.ahk
How to run it:
  1. Run the script by double-clicking on the file, or right-click>run
Troubleshooting:
  • If you use a different key for crouching in Battlefield 2, make sure to change it back to Lctrl, or edit the script to fit your needs
  • You can turn pause the script by right clicking the Autohotkey icon in the taskbar, then selecting "Pause Script"

Re: Working Crouch Toggle Script

Posted: 2013-07-29 21:50
by smgunsftw
WARNING: The use of this script has not been tested in an online game, please use at your own risk!

Punkbuster has had conflicts with Autohotkey in the past (see: BF2 Seatswitching Macro). Rest assured though, the script should not cause any problems with Project Reality 1.0.

Re: Working Crouch Toggle Script

Posted: 2013-07-29 21:55
by Spec
Neat.

But users, be advised that some server administrators may not allow any advanced scripts to be used by the players, and punkbuster might go nuts.

I personally always wanted toggle crouch for PR and can't see how this could be abused, though.

Re: Working Crouch Toggle Script

Posted: 2013-07-29 22:11
by smgunsftw
Can we have some people try this in an online game and report back with the results? Does the script work? Are there any punkbuster issues?

Re: Working Crouch Toggle Script

Posted: 2013-07-29 22:33
by Spec
Inform the admins before you do if you want to be on the safe side. I'm sure they won't mind, but they'd appreciate being informed. And they can arrange your unban if Punkbuster throws a fit ^^

Re: Working Crouch Toggle Script

Posted: 2013-07-29 22:45
by Wicca
Try it on PRTA. I dont mind.

Re: Working Crouch Toggle Script

Posted: 2013-07-29 22:49
by DesmoLocke
But will Punkbuster mind?...

Re: Working Crouch Toggle Script

Posted: 2013-07-29 22:55
by UTurista
The problem with Punkbuster would be with the program not the script, and so far I'm using AutoHotKey with others scripts without any issues.

So using this should be fine.

Re: Working Crouch Toggle Script

Posted: 2013-07-29 23:01
by labonte95
Neat-o. Good find. Will defiantly try this later when I'm 100% sure I won't be banned ;)

Re: Working Crouch Toggle Script

Posted: 2013-07-29 23:01
by Mineral
Nice. I heard some people having issues with BF2 specific crouch toggle scripts/programs in the 1.0 beta due to it not launching threw the bf2.exe or anymore. I guess this should work fine! I'll let them know.

Re: Working Crouch Toggle Script

Posted: 2013-07-30 01:33
by LITOralis.nMd
I love you.

I've broken my left pinky finger 4 times, including a gnarly bone out partial-severing of the interphal ligament, BF2's crouch system has often been the bane of my existence during long gaming sessions.

Re: Working Crouch Toggle Script

Posted: 2013-07-30 01:39
by smgunsftw
[R-COM]LITOralis.nMd wrote:I love you.

I've broken my left pinky finger 4 times, including a gnarly bone out partial-severing of the interphal ligament, BF2's crouch system has often been the bane of my existence during long gaming sessions.
Aww, thanks.

Re: Working Crouch Toggle Script

Posted: 2013-07-30 01:44
by smgunsftw
It would be great if someone could put this post up as a sticky in the tech support or BF2:Support forum section.

Re: Working Crouch Toggle Script

Posted: 2013-07-30 01:48
by LITOralis.nMd
We'll need to talk it over before we do that, generally encouraging autohotkey with FPS games is not a good thing.

Re: Working Crouch Toggle Script

Posted: 2013-07-30 01:50
by Wicca
[R-COM]LITOralis.nMd wrote:We'll need to talk it over before we do that, generally encouraging autohotkey with FPS games is not a good thing.

Because it encourages people to not work out their little finger. :P

Re: Working Crouch Toggle Script

Posted: 2013-07-30 03:51
by ComedyInK
[R-COM]LITOralis.nMd wrote:I love you.

I've broken my left pinky finger 4 times, including a gnarly bone out partial-severing of the interphal ligament, BF2's crouch system has often been the bane of my existence during long gaming sessions.
Curious

Why not change they key? I have crouch on space bar.

Re: Working Crouch Toggle Script

Posted: 2013-07-30 04:52
by waldov
Why isnt this just automatically implemented in 1.0? usually i frown on auto keys but this one is an essential.

Re: Working Crouch Toggle Script

Posted: 2013-07-30 05:01
by PLODDITHANLEY
Very handy for insurgents during mosque calls to prayer ... imagines 32 players crouching.

Re: Working Crouch Toggle Script

Posted: 2013-07-30 19:11
by smgunsftw
waldov wrote:Why isnt this just automatically implemented in 1.0? usually i frown on auto keys but this one is an essential.
It took several months for PRMumble1.0 to become the standard for the community, how long do you think it will take for the players?

The problem is that nobody wants to spend their time downloading multiple files for relatively trivial features.

Re: Working Crouch Toggle Script

Posted: 2013-08-05 09:11
by Davos
The script is somehow not working for me.

Using a win8 system.