My script needs a bit of help

Post gaming related scripts
Evil-e
Posts: 108
Joined: 04 Sep 2018, 11:09

My script needs a bit of help

23 Apr 2019, 12:58

The following script enables the use of a single key, to send a second key, after holding it down for 300ms:

Code: Select all

XButton2::TimeG:= A_PriorHotkey = "XButton2" ? TimeG : A_TickCount + 300 ;tap < 300ms
XButton2 Up::Send,% A_TickCount < TimeG ? "XButton2" : "{Esc}" ;sends either "XButton2" or "{Esc}"
Tap> XButton2 and sends itself and the script terminates at that point
HOLD> XButton2 for 300ms and it sends "ESC"

Once I have held the XButton2 for the necessary 300ms, I wish there to be a 3500ms delay PRIOR to the "ESC" key being
triggered.

:morebeard:

PS> This script was given to me by Rohwedder back in December
I have a bit of experience opening and sending commands to game console and CMD.exe... just ask :)
alclarkey
Posts: 5
Joined: 25 Apr 2019, 15:53

Re: My script needs a bit of help

14 May 2019, 18:01

Code: Select all

XButton2::
buttondown := (A_Sec * 1000) + A_MSec ; The current second * 1000 + the current millisecond
return

XButton2 Up::
buttonup := (A_Sec * 1000) + A_MSec
if (buttonup - buttondown) < 300
       {
        send {XButton2}
        return ; Not sure if this will end the hotkey thread here, or not. If not, you could replace this line with a goto and a label that skips past the "settimer" 
       }
SetTimer, sendesc, 3500
return

sendesc:
send {Esc}
return
alclarkey
Posts: 5
Joined: 25 Apr 2019, 15:53

Re: My script needs a bit of help

14 May 2019, 18:02

There was an attempt made, and you'll have to do some debugging probably, but hopefully this should give you some idea on how to make it work.

Return to “Gaming”

Who is online

Users browsing this forum: No registered users and 30 guests