Working Crouch Toggle Script

General discussion of the Project Reality: BF2 modification.
smgunsftw
Posts: 242
Joined: 2012-10-26 21:43

Working Crouch Toggle Script

Post 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"
Last edited by smgunsftw on 2013-07-29 23:14, edited 1 time in total.
smgunsftw
Posts: 242
Joined: 2012-10-26 21:43

Re: Working Crouch Toggle Script

Post 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.
Spec
Retired PR Developer
Posts: 8439
Joined: 2007-09-01 22:42

Re: Working Crouch Toggle Script

Post 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.
Image
--- currently reduced activity ---
Thanks to [R-MOD]IINoddyII for the signature!
_____________________________
Propriety is an adequate basis for behavior towards strangers, honesty is the only respectful way to treat friends.
smgunsftw
Posts: 242
Joined: 2012-10-26 21:43

Re: Working Crouch Toggle Script

Post 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?
Spec
Retired PR Developer
Posts: 8439
Joined: 2007-09-01 22:42

Re: Working Crouch Toggle Script

Post 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 ^^
Last edited by Spec on 2013-07-29 22:47, edited 1 time in total.
Image
--- currently reduced activity ---
Thanks to [R-MOD]IINoddyII for the signature!
_____________________________
Propriety is an adequate basis for behavior towards strangers, honesty is the only respectful way to treat friends.
Wicca
Posts: 7336
Joined: 2008-01-05 14:53

Re: Working Crouch Toggle Script

Post by Wicca »

Try it on PRTA. I dont mind.
Xact Wicca is The Joker. That is all.
DesmoLocke
Posts: 1770
Joined: 2008-11-28 19:47

Re: Working Crouch Toggle Script

Post by DesmoLocke »

But will Punkbuster mind?...
Image

Image

PR player since 0.5 (Feb 2007)

UTurista
PR:BF2 Developer
Posts: 985
Joined: 2011-06-14 14:13

Re: Working Crouch Toggle Script

Post 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.
Image


Dont question the wikipedia! Just because it reports different things on different languages does not make it unreliable source!
labonte95
Posts: 174
Joined: 2011-02-12 20:31

Re: Working Crouch Toggle Script

Post by labonte95 »

Neat-o. Good find. Will defiantly try this later when I'm 100% sure I won't be banned ;)

Thanks to WarEagle751 for the Signature pic!
User avatar
Mineral
Retired PR Developer
Posts: 8534
Joined: 2012-01-02 12:37
Location: Belgium

Re: Working Crouch Toggle Script

Post 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.
Image
LITOralis.nMd
Retired PR Developer
Posts: 5658
Joined: 2010-04-10 16:15

Re: Working Crouch Toggle Script

Post 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.
smgunsftw
Posts: 242
Joined: 2012-10-26 21:43

Re: Working Crouch Toggle Script

Post 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.
smgunsftw
Posts: 242
Joined: 2012-10-26 21:43

Re: Working Crouch Toggle Script

Post 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.
LITOralis.nMd
Retired PR Developer
Posts: 5658
Joined: 2010-04-10 16:15

Re: Working Crouch Toggle Script

Post 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.
Wicca
Posts: 7336
Joined: 2008-01-05 14:53

Re: Working Crouch Toggle Script

Post 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
Xact Wicca is The Joker. That is all.
ComedyInK
Posts: 225
Joined: 2011-03-16 16:33

Re: Working Crouch Toggle Script

Post 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.
waldov
Posts: 753
Joined: 2012-06-26 04:01

Re: Working Crouch Toggle Script

Post by waldov »

Why isnt this just automatically implemented in 1.0? usually i frown on auto keys but this one is an essential.
Image
PLODDITHANLEY
Posts: 3608
Joined: 2009-05-02 19:44

Re: Working Crouch Toggle Script

Post by PLODDITHANLEY »

Very handy for insurgents during mosque calls to prayer ... imagines 32 players crouching.
smgunsftw
Posts: 242
Joined: 2012-10-26 21:43

Re: Working Crouch Toggle Script

Post 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.
Davos
Posts: 37
Joined: 2012-12-25 12:41

Re: Working Crouch Toggle Script

Post by Davos »

The script is somehow not working for me.

Using a win8 system.
Post Reply

Return to “PR:BF2 General Discussion”