Re: Working Crouch Toggle Script
Posted: 2013-08-05 09:19
Are the devs okay with this? I don't want to get in trouble for having this, but I would love to have this.
Yeah I know, I just like to be careful.Spook wrote:You are not modifying the game, why would they mind or care about it?
~RCtrl up:: ;use RCtrl "up" so it doesn't get triggered when you hold ctrl
Goto, Crouch
Crouch:
; Changed: Trigger was changed to "~RCtrl" 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, {RCtrl down} ; Initiate 'Crouch'
If IsKeyPressed("RCtrl") ; Check if 'RCtrl' pressed. If pressed & released, Break loop.
Send, {RCtrl 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
}
Yes, would that conflict?a3dboy1 wrote:Pachira, have you changed in-game controls as well so RCtrl is crouch in game?
Actually, this is what you are supposed to do.Pachira wrote:Yes, would that conflict?
Yesa3dboy1 wrote:Actually, this is what you are supposed to do.
AutoHotKey has nothing to do with the game. It simply simulates pressed key when you actually don't hold it.
E.g. If you change the key to "C" you will notice that by double typing it you actually type "C" x3 times in chat/MS Word etc.
Strange, the script must work...
1. Do you have autohotkey installed?
2. Do you launch it before the game?
3. Do you have H icon in your system tray after you launch the script?
4. Try changing the key to letter or space bar and try the script in Word for example...
The idea was to check if script works correctly and according to what I see it does. Difference in small/big cases might come from Control Panel/Keyboard/Character repeat settings. But don't bother yourself with it.Pachira wrote:Yes
Yes
Yes
Tested it and it seems to still be a bit naffed. I got this when I tried it with a
"aAaaaaAaaaaaaaaaaaaaaAaaaAaaAaaAaaaaaaaaaaa"
The caps ones are the ones that were put in by the autohotkey (five second intervals between I pressed each time)
How does it work?Mora wrote:I also have a script that some of you might find interesting. Its a script that automates switching FLIR on/off Its in my signature.
smgunsftw wrote:How does it work?
Code: Select all
;RWin (right Windows key) is the button to turn on/off the script.
;LShift (left shift button) is the button to activate the script.
;If you want to remap the buttons, look up the keys in KeyList.html and change them accordingly in here.
$RWin::Suspend
$LShift::
{
Send {t down}
Send {LButton down}
Sleep 300
Send {LButton up}
Send {t up}
}
returnThanks, no more firing a 120 HEAT shell just because you wanted to switch to thermalMora wrote:Code: Select all
;RWin (right Windows key) is the button to turn on/off the script. ;LShift (left shift button) is the button to activate the script. ;If you want to remap the buttons, look up the keys in KeyList.html and change them accordingly in here. $RWin::Suspend $LShift:: { Send {t down} Send {LButton down} Sleep 300 Send {LButton up} Send {t up} } return
The only way to disable it while browsing the web is by exiting autohotkey all together, I haven't found another solution atm.PoisonBill wrote:This thing sure screws around with you when you have it on browsing the web!
Works like a charm in game though, very nice!![]()
You can toggle suspend the script with $key::Suspend Just look at my script a couple of post above here.smgunsftw wrote:The only way to disable it while browsing the web is by exiting autohotkey all together, I haven't found another solution atm.
i made some crouch toggle scripts a while back for some friends and myself:smgunsftw wrote:The only way to disable it while browsing the web is by exiting autohotkey all together, I haven't found another solution atm.
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 {LCTrl up}
toggle = 0
Suspend, on
}
return
~*F12::
Suspend
SendInput {LCtrl up}
toggle = 0
Return
*$Lcontrol::
start_time := A_TickCount
SendInput {LCtrl down}
KeyWait LCtrl
elapsed_time := A_TickCount - start_time
if elapsed_time < 300
{
if toggle = 1
{
SendInput {LCtrl up}
toggle = 0
}
else
{
toggle = 1
}
}
else
SendInput {LCtrl Up}
Return
~*z::
~*`::
~*e::
~*Space::
SendInput {LControl Up}
toggle = 0
Return
~*j::
~*k::
~*l::
if GetKeyState("Lcontrol","L")
{
Z = 1
KeyWait LControl
SendInput {LControl Up}
}
Return
~*Esc::
if z = 1
{
Sleep 200
SendInput {LControl Down}
z = 0
toggle = 1
}
else{
SendInput {LControl Up}
toggle = 0
}
Return
~*Enter::
~*NumpadEnter::
if z = 1
{
SendInput {LControl down}
z = 0
toggle = 1
}
Return
*LShift::
SendInput {LControl Up}
toggle = 0
SendInput {Lshift up}
Sleep 30
SendInput {LShift Down}
KeyWait Lshift
SendInput {LShift Up}
ReturnCode: 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