Perfecting a AHK Toggle Crouch System

General discussion of the Project Reality: BF2 modification.
Post Reply
Nightingale
Posts: 352
Joined: 2013-11-19 21:08

Perfecting a AHK Toggle Crouch System

Post by Nightingale »

LATEST VERSIONS

[R-CON]Mats391: link to download
Use config.ini to set your keybinds. Refer to AutoHotkey documentation for denoting special keys like 'LCtrl', 'RAlt', 'RWin' if you are going to use any of those keys. This is the best solution to the crouch toggle problem I have seen yet.


============

OLD STUFF (Skip everything below if you just want to use the most up-to-date crouch toggle solutions)


(For those who don't know what this thread is about: AutoHotkey is a piece of software that allows the user to alter the way that keyboard/mouse inputs are directed into BF2.exe without actually changing the operation of BF2.exe. It allows us to "fake" holding down a keystroke for a certain amount of time without actually doing it. It has a lot of other uses as well for other games/software and is very customizable.)

I have tried out the AHK toggle crouches that some other people have made for PR. A lot of these AHKs make the crouch toggle work in the most basic form, but they all invariably cause some other aspect of the game to malfunction in some way. Most of them cause the in-game chat to seize up and become unusable, or to get stuck into other kinds of loops. With the community's help, I want to make a fully functioning crouch toggle for PR:BF2 that does not interfere with in-game chatting or using applications outside of BF2.exe. When it is perfected, we can post the code and format it so that laymen can easily customize it to their own personal choice of keybindings.

The best .ahk I have seen made is the one created by [R-CON]Mats391: link to post. It's pretty impressive.

There were some lines in Mats391's code that I didn't understand entirely, but I was able to adapt it to my own layout without much trouble. (I use a QWERTY keyboard. I use 'C' for crouch, and 'LAlt' for prone.)

The only problem I had with Mats391's AHK is that sometimes the in-game chat totally seizes up, even though it works perfectly fine at the start. For example, when I press 'K' to type in team chat, I can only type letters by pressing 'T', 'Enter', 'E', 'Enter', 'S', 'Enter', 'T', 'Enter', and then a final 'Enter' to put it in chat. The end result in chat is: "t?st". Why it behaves like this is a total mystery to me. Once the problem arises, it stays for as long as 2 hours and goes away with no discernible pattern. It happens basically every match. Also, for some reason, BF2 doesn't understand the 'e' keystroke when this thing happens and makes it a '?' mark instead. :? ??:

This kind of problem happens to me with basically any kind of autohotkey crouch toggle that I try, and it's a complete mystery to me why it happens and behaves in such an odd way.

Now let me share with you the AHK I am currently working on:

Code: Select all

Suspend, on
SetTitleMatchMode 2
SetTimer, KeepRunning, 500
return

KeepRunning:
WinWaitActive, BF2, ,
	if ErrorLevel = 0
	{
		Suspend, off
	}

WinWaitNotActive, BF2, ,
	if ErrorLevel = 0
	{
		SendInput {RShift up}
		ctoggle = 0
		ptoggle = 0
		chatting = 0
		Suspend, on
	}
return


~*c::
    if chatting = 1
    {
        return
    }
    else
    {
        if ptoggle = 1
        {
            SendInput {RShift down}
            ptoggle = 0
            ctoggle = 1
        }
        else
        {
            if ctoggle = 1
            {
                SendInput {Rshift up}
                ctoggle = 0
            }
            else
            {
                SendInput {RShift down}
                ctoggle = 1
            }
        }    
    }
return


~*LAlt::
    if ptoggle = 1
    {
        ptoggle = 0
    }
    else
    {
        ptoggle = 1
    }
    if ctoggle = 1
    {
        SendInput {Shift up}
        ctoggle = 0
    }
return


~*j::
~*k::
~*l::
    if ctoggle = 1
    {
        SendInput {Rshift up}
        ctoggle = 0
    }

    if chatting = 1
    {
        return
    }
    
    chatting = 1
    KeyWait, Enter
    chatting = 0
return


*~Esc::
*~Space::
*~e::
    if ctoggle = 1
    {
        SendInput {RShift Up}
        ctoggle = 0
    }
return


*~$RCtrl::
    ctoggle = 0
    ptoggle = 0
    chatting = 0
    SendInput {RShift up}
    SendInput {LAlt up}
    SendInput {LShift up}
    SendInput {Space up}
    SendInput {j up}
    SendInput {k up}
    SendInput {l up}
    SendInput {e up}
return

return
(I use the 'C' key for crouch, 'LAlt' for prone, and 'v' for map. To allow the code to work properly, 'RShift' is assigned in-game as my crouch key and the code simulates a crouch using 'RShift' instead of 'C'.)

If you are also a crouch toggle user, feel free to try this out, customize it to your keybinds, and let me know what works and what doesn't. :smile:

I'm not totally familiar with all of the AutoHotkey language so I'm not totally sure what the best way is to suspend the AHK outside of BF2.exe

Thanks for reading!

============================

EXPLANATION OF THE AHK

Code: Select all

Suspend, on
SetTitleMatchMode 2
SetTimer, KeepRunning, 500
return

KeepRunning:
WinWaitActive, BF2, ,
	if ErrorLevel = 0
	{
		Suspend, off
	}

WinWaitNotActive, BF2, ,
	if ErrorLevel = 0
	{
		SendInput {RShift up}
		ctoggle = 0
		ptoggle = 0
		chatting = 0
		Suspend, on
	}

return

[color=RoyalBlue]~*c::
; If the player is chatting, then the autohotkey does nothing when C is pressed.
    if chatting = 1
    {
        return
    }
    ; This part releases the ptoggle if the player is trying to rise to crouch from prone.     
    else
    {
        if ptoggle = 1
        {
            SendInput {RShift down}
            ptoggle = 0
            ctoggle = 1
        }
        else
        {
            if ctoggle = 1
            {
                SendInput {Rshift up}
                ctoggle = 0
            }
            else
            {
                SendInput {RShift down}
                ctoggle = 1
            }
        }
    }
return[/color]
[color=Gray]This is the "core" of the AHK. When 'C' is pressed, it first checks if the player is currently chatting. If the player is chatting, then nothing special happens and the AHK just passes through a simple 'C' keystroke into the chat. If the player is not chatting, then the AHK checks if the player is currently prone. If he is prone, then the AHK tells itself that ptoggle = 0 (meaning that the player is not prone) and then holds down 'C' to rise the player from prone and keep him crouched. If the player is also not prone, then the AHK checks to see if the player is currently crouched. If ctoggle = 1, then the AHK sends out a 'C' key is up signal so that the player stands back up. If ctoggle = 0 (ie. the player is standing) then 'C' is held down to put him into crouch.[/color]


[color=Purple]~*LAlt::
    if ptoggle = 1
    {
        ptoggle = 0
    }
    else
    {
        ptoggle = 1
    }
    if ctoggle = 1
    {
        SendInput {Shift up}
        ctoggle = 0
    }
return[/color]
[color=Gray]This part of the AHK only keeps track of whether or not the player is prone. It could be possible that it is a redundant part of the AHK, but I'm keeping it for now because it doesn't cause any problems.[/color]


[color=SeaGreen]
~*j::
~*k::
~*l::
    if ctoggle = 1
    {
        SendInput {Rshift up}
        ctoggle = 0
    }

    if chatting = 1
    {
        return
    }
    
    chatting = 1
    KeyWait, Enter
    chatting = 0
return[/color]
[color=Gray]This is the chatting part of the AHK, and it is the most problematic part. First, it checks if the player is currently crouched. If he is, then the AHK uncrouched him. Then it tells itself that it is in "chat mode", so that the ~*c:: branch is able to function properly (see above). Then it waits for the user to press 'Enter', to signal that he is done chatting. Only then does the AHK tell itself that it is not chatting, and allows the other keys to resume normal function. [/color]


[color=SandyBrown]
*~Esc::
*~Space::
*~e::
    if ctoggle = 1
    {
        SendInput {RShift Up}
        ctoggle = 0
    }
return[/color]
[color=Gray]This uncrouches the player if he tries to jump, enter a vehicle, or accesses the options menu. Very simple.[/color]


[color=Red]*~$RCtrl::
    ctoggle = 0
    ptoggle = 0
    chatting = 0
    SendInput {RShift up}
    SendInput {LAlt up}
    SendInput {LShift}
    SendInput {Space up}
    SendInput {e up}
    SendInput {j up}
    SendInput {k up}
    SendInput {l up}
    SendInput {v up}
    SendInput {e up}
    SendInput {b up}
return[/color]
[color=Gray]I made this as a backup mechanism to the AHK in case a problem occurs. It just resets all the values to 0, and stops all keys from being held down. An ugly solution, but it works sometimes when I can't get out of prone.[/color]


return
Last edited by Nightingale on 2014-09-17 13:51, edited 4 times in total.
ComradeHX
Posts: 3294
Joined: 2009-06-23 17:58

Re: Perfecting a AHK Toggle Crouch System

Post by ComradeHX »

How much can you really "perfect" it?

I used to use AHK for key-spamming in Mass Effect 3 and ran into problems.
Nightingale
Posts: 352
Joined: 2013-11-19 21:08

Re: Perfecting a AHK Toggle Crouch System

Post by Nightingale »

Well, yeah, it's not possible to actually have a "perfect" AHK that allows you to be crouched while typing in chat. Or to keep you crouched while pressing Esc to change your game options.

The goal is to allow the player to toggle crouch and to also be able to (reliably) type in the in-game chat. I think it's important for squad leaders to be able to relay information via chat (and also to be able to name squads properly), so I don't think it's trivial to be concerned about having chat functionality with the AHK.

If it turns out that it's impossible to have the AHK deduce when the player is typing and prevent the crouch-toggle from interfering with typing, then I guess the next best solution is to have a key that turns the AHK on and off, so the player can disable toggle-crouch everytime he wants to chat, and then enable it again when he is done chatting.


===========================

I hope Mats391 doesn't mind, but I basically just copy-pasted his AHK suspending code into mine and altered it slightly. Now the AHK doesn't affect applications outside of BF2.exe I've formatted a copy for others to use and made it easy for them to use and try out the AHK I've made. The first post has also been changed to the newest version.

You must assign R-Shift to be crouch in-game for this AHK to work.
Use Notepad to replace the following with your choice of keybind:
<CRO> = crouch
<PRO> = prone
<TXA> = all chat
<TXT> = team chat
<TXS> = squad chat
<JMP> = jump
<EVH> = enter vehicle, use emplacement, etc.
<RST> = reset autohotkey backup key

Code: Select all

Suspend, on
SetTitleMatchMode 2
SetTimer, KeepRunning, 500
return

KeepRunning:
WinWaitActive, BF2, ,
	if ErrorLevel = 0
	{
		Suspend, off
	}

WinWaitNotActive, BF2, ,
	if ErrorLevel = 0
	{
		SendInput {RShift up}
		ctoggle = 0
		ptoggle = 0
		chatting = 0
		Suspend, on
	}

return

~*<CRO>::
	if chatting = 1
	{
		return
	}
	else
	{
		if ptoggle = 1
		{
			SendInput {RShift down}
			ptoggle = 0
			ctoggle = 1
		}
		else
		{
			if ctoggle = 1
			{
				SendInput {Rshift up}
				ctoggle = 0
			}
			else
			{
				SendInput {RShift down}
				ctoggle = 1
			}
		}	
	}
return


~*<PRO>::
	if ptoggle = 1
	{
		ptoggle = 0
	}
	else
	{
		ptoggle = 1
	}
	if ctoggle = 1
	{
		SendInput {Shift up}
		ctoggle = 0
	}
return


~*<TXA>::
~*<TXT>::
~*<TXS>::
	if ctoggle = 1
	{
		SendInput {Rshift up}
		ctoggle = 0
	}

	if chatting = 1
	{
		return
	}
	
	chatting = 1
	KeyWait, Enter
	chatting = 0
return


*~<ESC>::
*~<JMP>::
*~<EVH>::
	if ctoggle = 1
	{
		SendInput {RShift Up}
		ctoggle = 0
	}
return


*~$<RST>::
	ctoggle = 0
	ptoggle = 0
	chatting = 0
	SendInput {RShift up}
	SendInput {<PRO> up}
	SendInput {<SPR> up}
	SendInput {<JMP> up}
	SendInput {<TXA> up}
	SendInput {<TXT> up}
	SendInput {<TXS> up}
	SendInput {<EVH> up}
return


return
Last edited by Nightingale on 2014-09-13 10:49, edited 3 times in total.
Psyrus
Retired PR Developer
Posts: 3841
Joined: 2006-06-19 17:10

Re: Perfecting a AHK Toggle Crouch System

Post by Psyrus »

Nightingale wrote:If it turns out that it's impossible to have the AHK deduce when the player is typing and prevent the crouch-toggle from interfering with typing, then I guess the next best solution is to have a key that turns the AHK on and off, so the player can disable toggle-crouch everytime he wants to chat, and then enable it again when he is done chatting.
Why not just make that disable "j, k, l" (aka the default chat keys) and then have "Enter" to enable it (not toggle). If you package it as an exe you can also make a small settings.ini that holds the keybinds for you, so that people with custom chat keys can use those instead.
Nightingale
Posts: 352
Joined: 2013-11-19 21:08

Re: Perfecting a AHK Toggle Crouch System

Post by Nightingale »

I'm actually not very experienced with coding or using AHK or compiling .exes with .inis from it, haha. I don't know how to package it into a folder and have the AHK refer to the .ini for keybind info. That's why I'm asking for help from other AHK users. I know there are others on this forum who are trying to accomplish the same thing.
[R-CON]Psyrus wrote:Why not just make that disable "j, k, l" (aka the default chat keys) and then have "Enter" to enable it (not toggle).
???

By the way guys, in case it isn't clear from the first post: Please feel free to modify this AHK in any way you want and share your changes here in this thread. It's a community effort to give players a reliable toggle crouch system for playing PRBF2 with. I'm not a good programmer. I'm just a guy who can't play without toggle crouch.

================

A question to my fellow crouch-togglers: Do you have chatting problems in-game when you use your AHK? If I'm the only one then I'm going to feel stupid for making this thread, lol.
Last edited by Nightingale on 2014-09-13 10:49, edited 3 times in total.
User avatar
Mats391
PR:BF2 Lead Developer
Posts: 7643
Joined: 2010-08-06 18:06

Re: Perfecting a AHK Toggle Crouch System

Post by Mats391 »

Hi,
i never had those chatting problems you describe, but im using another version for quite some time now.
I started using RWin instead of RShift as crouch key ingame. Works better for me and prevents accidental capital letters when chatting.
This latest version is pretty much only for personal use as i added a joystick simulation using VJoy and VJoy_lib (Not sure if correct source, forgot where i got it from :) ) for ahk. With this i made myself a slow-drive mode for vehicles.
Feel free to have a look at it and ask any questions you have :)
Download

If there is demand for it, i can make a new crouch toggle only version or an easy to setup VJoy one.
Nightingale
Posts: 352
Joined: 2013-11-19 21:08

Re: Perfecting a AHK Toggle Crouch System

Post by Nightingale »

Oh god, I have no idea what I'm looking at. :shock: That is an insanely sophisticated solution to playing PRBF2, Mats391. I don't use any kind of stick to play, but this must be fantastic for others with a fancy gaming setup to use. Thanks for sharing!
i never had those chatting problems you describe
Okay, that is really really weird then. Maybe it is because you use an AZERTY keyboard? I have this chatting problem on both your AHK and my own. Can I get a QWERTY crouch-toggler to comment in on this?
I started using RWin instead of RShift as crouch key ingame. Works better for me and prevents accidental capital letters when chatting.
That should fix the "cCcCcCcC" in my AHK. I really wonder why my "if chatting = 1, return" system fails to avoid this problem.
IGN: 1993 TOYOTA_PREVIA
User avatar
Mats391
PR:BF2 Lead Developer
Posts: 7643
Joined: 2010-08-06 18:06

Re: Perfecting a AHK Toggle Crouch System

Post by Mats391 »

Nightingale wrote:Oh god, I have no idea what I'm looking at. :shock: That is an insanely sophisticated solution to playing PRBF2, Mats391. I don't use any kind of stick to play, but this must be fantastic for others with a fancy gaming setup to use. Thanks for sharing!
I dont use any stick to play PR either. That is why i made myself this joystick-emulator :) .
When ignoring the whole joystick thing it isnt that much more than you already have. Just a couple of more keys i think.
Nightingale wrote: Okay, that is really really weird then. Maybe it is because you use an AZERTY keyboard? I have this chatting problem on both your AHK and my own. Can I get a QWERTY crouch-toggler to comment in on this?
I use QWERTZ keyboard and have friends using it with QWERTY, noone ever reported such an error.
What oh my scripts are you using to compare?
I think your chatting problem comes from

Code: Select all

KeyWait, Enter
in your chatting part. In general this isnt that good. You can cancel chatting with NumpadEnter and ESC as well and those wont be detected by you.
Nightingale
Posts: 352
Joined: 2013-11-19 21:08

Re: Perfecting a AHK Toggle Crouch System

Post by Nightingale »

Mats, this is the AHK you posted which I tried out (all I did was adapt it to QWERTY, and made 'LAlt' the prone button.):

Code: Select all

Suspend, on
SetTitleMatchMode 2
SetTimer, KeepRunning, 500
chatting = 0
return

KeepRunning:
WinWaitActive, BF2, ,
	if ErrorLevel = 0
	{
		Suspend, off
	}

WinWaitNotActive, BF2, ,
	if ErrorLevel = 0
	{
		SendInput {RShift up}
		toggle = 0
		Suspend, on
	}
return


*~$C::    
		if(chatting = 1)
			Return
			
		SendInput {RShift down}

		KeyWait C
			if toggle = 1
			{
				 SendInput {RShift up}
				 toggle = 0
			}
			else
			{
				 toggle = 1
			}
Return
                    
~*y::
~*^::
~*e::
~*Space::
  SendInput {RShift Up}
  toggle = 0
Return

~*j::
~*k::
~l:: 
	chatting = 1
	if toggle = 1
	{
		SendInput {RShift Up} 
		crouchBefore = 1   
		toggle = 0
	}
Return

~*Esc::	
	chatting = 0
	if crouchBefore = 1
	{
	   Sleep 200
	   SendInput {RShift Down}
	   crouchBefore = 0
	   toggle = 1
	}
	else{
	   SendInput {RShift Up}
	   toggle = 0
	}
Return

~*Enter:: 
~*NumpadEnter::
	chatting = 0
    if crouchBefore = 1
	{
	   SendInput {RShift down}
	   crouchBefore = 0
       toggle = 1
	}
Return

*LShift::	
	SendInput {RShift Up}
	toggle = 0
	SendInput {Lshift up}   

	Sleep 30

	SendInput {LShift Down}
	KeyWait Lshift 
	SendInput {LShift Up} 
Return
Update on my own AHK: I replaced RShift with RWin like you said, and it works a lot better now! The text chat doesn't seize up! :smile:

The only problem now is that I cannot type the letter 'h' into the chat, and I also have to press 'c' twice to register a single 'c' keystroke in the chat. So typing a word like "chinchilla" is very troublesome in-game. But it's way better than the old problem.

I'll post an updated version of my own AHK tomorrow when I'm not feeling so lazy.
I think your chatting problem comes from

Code: Select all

KeyWait, Enter
in your chatting part. In general this isnt that good. You can cancel chatting with NumpadEnter and ESC as well and those wont be detected by you.
Oh, I didn't know that. I have never ever used NumpadEnter or Esc to cancel my chat, so I don't think it caused the chat problem but I'll have to fix it up. How can I tell Autohotkey to do somethings like this: KeyWait, (Esc OR NumpadEnter OR Enter)?
IGN: 1993 TOYOTA_PREVIA
User avatar
Mats391
PR:BF2 Lead Developer
Posts: 7643
Joined: 2010-08-06 18:06

Re: Perfecting a AHK Toggle Crouch System

Post by Mats391 »

Nightingale wrote:Mats, this is the AHK you posted which I tried out (all I did was adapt it to QWERTY, and made 'LAlt' the prone button.):

Update on my own AHK: I replaced RShift with RWin like you said, and it works a lot better now! The text chat doesn't seize up! :smile:
I think i know what caused your chat problem before then. Do you have multiple languages installed? E.g. a french one since you are from Canada? In that case you would be switching between those with ALT+Shift, so basically every time you go from crouch to prone with your setup. If that second language uses characters that bf2 does not know, it would explain those errors
Nightingale wrote: The only problem now is that I cannot type the letter 'h' into the chat, and I also have to press 'c' twice to register a single 'c' keystroke in the chat. So typing a word like "chinchilla" is very troublesome in-game. But it's way better than the old problem.

I'll post an updated version of my own AHK tomorrow when I'm not feeling so lazy.
Oh that is really bad considering the amount of chinchillas in PR :p
Having to press certain keys twice i did have before, but forgot how i solved it. That some key isnt working i never had.
Nightingale wrote: Oh, I didn't know that. I have never ever used NumpadEnter or Esc to cancel my chat, so I don't think it caused the chat problem but I'll have to fix it up. How can I tell Autohotkey to do somethings like this: KeyWait, (Esc OR NumpadEnter OR Enter)?
Nope. Best is to set the chatting variable to true when any chat keys are pressed and to false when any of the chat cancel keys are pressed.
Nightingale
Posts: 352
Joined: 2013-11-19 21:08

Re: Perfecting a AHK Toggle Crouch System

Post by Nightingale »

[R-CON]Mats391 wrote:I think i know what caused your chat problem before then. Do you have multiple languages installed? E.g. a french one since you are from Canada? In that case you would be switching between those with ALT+Shift, so basically every time you go from crouch to prone with your setup. If that second language uses characters that bf2 does not know, it would explain those errors
Oh. Mein. GOTT. So that was what was doing it! Besides US English, I have Japanese IME installed on my computer. I went and disabled all of the language-switching keybinds and now it works a lot better. I also revised the chat system like you said, and now I think it works almost flawlessly. I will test it in-game for a bit before reporting back here with the updated AHK.
IGN: 1993 TOYOTA_PREVIA
Nightingale
Posts: 352
Joined: 2013-11-19 21:08

Re: Perfecting a AHK Toggle Crouch System

Post by Nightingale »

NEWEST VERSION:

Code: Select all

Suspend, on
SetTitleMatchMode 2
SetTimer, KeepRunning, 500
return


KeepRunning:
WinWaitActive, BF2, ,
	if ErrorLevel = 0
	{
		Suspend, off
	}


WinWaitNotActive, BF2, ,
	if ErrorLevel = 0
	{
		SendInput {RWin up}
		ctoggle = 0
		ptoggle = 0
		chatting = 0
		Suspend, on
	}

return


~*c::
	if chatting = 1
	{
		return
	}
	else
	{
		if ptoggle = 1
		{
			SendInput {RWin down}
			ptoggle = 0
			ctoggle = 1
			return
		}
		else
		{
			if ctoggle = 1
			{
				SendInput {RWin up}
				ctoggle = 0
			}
			else
			{
				SendInput {RWin down}
				ctoggle = 1
			}
		}	
	}
return


~*LAlt::
	if ctoggle = 1
	{
		SendInput {Shift up}
		ctoggle = 0
	}
	else
	{
		if ptoggle = 1
		{
			ptoggle = 0
		}
		else
		{
			ptoggle = 1
		}
	}
return


~*j::
~*k::
~*l::

	if chatting = 1
	{
		return
	}
	else
	{
		chatting = 1
	}

	if ctoggle = 1
	{
		SendInput {RWin up}
		ctoggle = 0
	}
return


~*Enter::
~*NumpadEnter::
~*Esc::
	chatting = 0

	if ctoggle = 1
	{
		SendInput {RWin Up}
		ctoggle = 0
	}
return
	

*~Space::
*~e::
	if ctoggle = 1
	{
		SendInput {RWin Up}
		ctoggle = 0
	}
return


*~$RCtrl::
	ctoggle = 0
	ptoggle = 0
	chatting = 0
	SendInput {RWin up}
	SendInput {LAlt up}
	SendInput {LShift up}
	SendInput {Space up}
	SendInput {j up}
	SendInput {k up}
	SendInput {l up}
	SendInput {e up}
return


return
Just putting this here if anyone wants to try it out. I think I've sorted out the text chat seizing up. 'c' and 'h' keys are still a bit wierd and sometimes dont work during chatting. Also, sometimes it's difficult to rise to crouch from prone. So that will have to be fixed too.
IGN: 1993 TOYOTA_PREVIA
User avatar
Mats391
PR:BF2 Lead Developer
Posts: 7643
Joined: 2010-08-06 18:06

Re: Perfecting a AHK Toggle Crouch System

Post by Mats391 »

The prone to crouch could be because there is a delay till you can stand up again after going prone. That delay is 0.8s. Not much you can do about it other than adding the same delay to your script to prevent undefined states (script says you are crouch, but you arent).
I also made some improvements to my script. You can check if the chat issues are present in there:
https://github.com/Mats391/PRCrouchToggle
Nightingale
Posts: 352
Joined: 2013-11-19 21:08

Re: Perfecting a AHK Toggle Crouch System

Post by Nightingale »

Mats391, I tried yours a little bit today and it seems to work without any problems at all. :grin: The formatting is unreadable when I open it in Notepad, so I don't know how you implemented, it but it is definitely working better than mine. Just for curiosity's sake though, I will be trying to figure out why mine has problems and not yours. I'll update the first post to include this AHK/exe you shared with us.
Last edited by Nightingale on 2014-09-17 13:52, edited 1 time in total.
IGN: 1993 TOYOTA_PREVIA
User avatar
Mats391
PR:BF2 Lead Developer
Posts: 7643
Joined: 2010-08-06 18:06

Re: Perfecting a AHK Toggle Crouch System

Post by Mats391 »

Nightingale wrote:Mats391, I tried yours a little bit today and it seems to work without any problems at all. :grin: The formatting is unreadable when I open it in Notepad, so I don't know how you implemented, it but it is definitely working better than mine. Just for curiosity's sake though, I will be trying to figure out why mine has problems and not yours. I'll update the first post to include this AHK/exe you shared with us.
Try using Notepad++, that is what i coded it in. Or you can just view it on github rather readable.
Nightingale
Posts: 352
Joined: 2013-11-19 21:08

Re: Perfecting a AHK Toggle Crouch System

Post by Nightingale »

Okay I've been using your system for a few days Mats391, and I have some feedback:
  • The chatting system works very well. No keyboard problems here! :grin:
  • Occassionally (maybe once every 3 matches), the crouch key becomes unresponsive and I have to restart the entire AHK from Windows to crouch again. So I think implementing a back-up "reset key" would make the AHK even better.
  • It is only personal preference, but I don't like how the AHK crouches you again after you send a message from the crouching position. It feels like a loss of control of the soldier, and I would prefer to remain standing up after typing a message from the crouching position. But again, this is just personal preference. Maybe I can just edit it to do it my way for my own personal use.
[R-CON]Mats391 wrote:The prone to crouch could be because there is a delay till you can stand up again after going prone. That delay is 0.8s. Not much you can do about it other than adding the same delay to your script to prevent undefined states (script says you are crouch, but you arent).
Thanks for the info! I'll try putting this into my own AHK.
IGN: 1993 TOYOTA_PREVIA
User avatar
Mats391
PR:BF2 Lead Developer
Posts: 7643
Joined: 2010-08-06 18:06

Re: Perfecting a AHK Toggle Crouch System

Post by Mats391 »

Feel free to modify my script. If you have a github account i can also add you to be able to commit any changes.
Post Reply

Return to “PR:BF2 General Discussion”