Reputation: 25
So this sequence resets itself after 1.5 sec (t:=1500) which means if i dont hit the left mouse button for 1.5 sec it always sends A. Otherwise it sends the next letter after each click.
I want to further tweak this code with these other functions which are:
If i let go the LButton between 0 - 0.3 seconds, it sends 0 resets the sequence
If i let go the LButton between 0.3 - 0.6 seconds, it dont sends 0 continue the sequence
If i let go the LButton between 0.6 - 1.2 seconds, it sends 0 resets the sequence
If i let go the LButton between 1,2 - above seconds, it dont sends 0 continue the sequence
The zero key is a function in the game thats why i need after LMB keywait! .
global s:=0, c:=0, t:=1500
Seqkeys(params*) {
global s, c, t
max := params.MaxIndex()
(A_TickCount-s<=t && (c+=1)<=max) ? c : c:=1
s := A_TickCount
return params[c]
}
*LButton::
Send % Seqkeys("A","B")
KeyWait, LButton
Send, 0
Return
*0:: c := 1 s := 0 Return
Upvotes: 0
Views: 227
Reputation: 192
Is this what you want?
#NoEnv
#Warn
#SingleInstance Force
#UseHook
SetWorkingDir %A_ScriptDir%
SendMode Input
Global nCount := 1, nTimeOut := 1500
Seqkeys(params*) {
Local
Global nCount, nTimeOut
If ( (A_TimeSincePriorHotkey > 300) and (A_TimeSincePriorHotkey < nTimeOut) ) {
sChar := params[nCount]
nCount := (nCount == params.MaxIndex()) ? 1 : (nCount + 1)
return sChar
}
return 0
}
*LButton::
KeyWait, LButton
Send % Seqkeys("A","B","C")
Return
If not, you should try to rephrase your question, because it's not easy to understand. I have no idea what you want in your last paragraph, for example.
Upvotes: 1