Double tap + hold as input?
- CandyClout
- Posts: 7
- Joined: 27 Jul 2022, 13:45
Double tap + hold as input?
I'm trying to make up for what ARK left out.
I'd like to be able to tap w, release w, tap w and hold for 1 second as the input to hold down w until any of these keys are pressed: w, i, f, l, e,
I would also like it to do the same for the e key just like the w key.
I'm very confused as to how to make this input work.
I have a primitive version that just holds down w when i press CTRL+W but its far from functioning smoothly. I also couldn't figure out how to make it only work if ARK window is selected/open.
Thanks for all future help and suggestions.
[Mod action: Topic moved from "[V1] Ask for Help" since this for a game.]
I'd like to be able to tap w, release w, tap w and hold for 1 second as the input to hold down w until any of these keys are pressed: w, i, f, l, e,
I would also like it to do the same for the e key just like the w key.
I'm very confused as to how to make this input work.
I have a primitive version that just holds down w when i press CTRL+W but its far from functioning smoothly. I also couldn't figure out how to make it only work if ARK window is selected/open.
Thanks for all future help and suggestions.
[Mod action: Topic moved from "[V1] Ask for Help" since this for a game.]
Re: Double tap + hold as input?
Hello,
Here is a start with the W.
Here is a start with the W.
Code: Select all
#Requires AutoHotkey v1.1.33
app := "ahk_exe notepad.exe"
#If on
w::
i::
f::
l::
e::
Send {w up}
SoundBeep 700
on := False
Return
#If WinActive(app)
$w::
KeyWait w, T.2
If ErrorLevel { ; Press #1: key was held
While GetKeyState("w", "P") {
Send w
Sleep 20
}
Return
} ; Press #1: key was not held
KeyWait w, DT.2
If ErrorLevel { ; Key was not pressed a second time
Send w
SoundBeep 1500
Return
} ; Key was pressed a second time
KeyWait w, T1
If ErrorLevel { ; Press #2: key was held for at least 1 second
Send {w down}
SoundBeep 2200
KeyWait w
on := True
SoundBeep 900
} Else { ; Press #2: key was not held for at least 1 second
Send ww
SoundBeep 2000
}
Return
#If
- CandyClout
- Posts: 7
- Joined: 27 Jul 2022, 13:45
Re: Double tap + hold as input?
So I've got this code below. I removed the first w from the #If on list because it said it was a duplicate, and no big deal if w isn't list there:
But when I run it, I receive
Code: Select all
#Requires AutoHotkey v1.1.33
app := "ahk_exe notepad.exe"
#If on
d::
i::
f::
l::
e::
x::
Send {w up}
SoundBeep 700
on := False
Return
#If WinActive(ARK: Survival Evolved)
$w::
KeyWait w, T.2
If ErrorLevel { ; Press #1: key was held
While GetKeyState("w", "P") {
Send w
Sleep 20
}
Return
} ; Press #1: key was not held
KeyWait w, DT.2
If ErrorLevel { ; Key was not pressed a second time
Send w
SoundBeep 1500
Return
} ; Key was pressed a second time
KeyWait w, T1
If ErrorLevel { ; Press #2: key was held for at least 1 second
Send {w down}
SoundBeep 2200
KeyWait w
on := True
SoundBeep 900
} Else { ; Press #2: key was not held for at least 1 second
Send ww
SoundBeep 2000
}
Return
#If
But when I run it, I receive
Code: Select all
Error: Missing ")" before ":"
Line#
002: app := "ahk_exe notepade.exe
004: #If,on
005: Return
.....continues to 022.....
- CandyClout
- Posts: 7
- Joined: 27 Jul 2022, 13:45
Re: Double tap + hold as input?
So, It said I was using a duplicate hotkey, so I removed the w from the #If on list, which is no big deal. I also can't use the If Win Active, bc the window is "ARK: Survival Evolved" and has a ':' in it.
But when I remove both of those, it still does nothing.
But when I remove both of those, it still does nothing.
Re: Double tap + hold as input?
The script that I posted generates no errors. I would like to know if it works without any changes. This tells you if you have a working starting point. If it works, the script can then be modified.
If you see an error, you can post your exact script, a screenshot of the error message, and your AHK version number.
If you see an error, you can post your exact script, a screenshot of the error message, and your AHK version number.
- CandyClout
- Posts: 7
- Joined: 27 Jul 2022, 13:45
Re: Double tap + hold as input?
I can't use the If Win Active bc of the window name, but when I remove that, it breaks the code.
Re: Double tap + hold as input?
If you mean you can't use #If WinActive because of this line:
...it's because your syntax is incorrect. Function parameters are always expressions, and literal strings in expressions must always be quoted:
Code: Select all
#If WinActive(ARK: Survival Evolved)
Code: Select all
#If WinActive("ARK: Survival Evolved")
- CandyClout
- Posts: 7
- Joined: 27 Jul 2022, 13:45
Re: Double tap + hold as input?
That was a huge help but now I can ONLY use 'w' by using the double-tap and hold- without the ability to simply hold down w manually to move forward.