Please help me complete this script

Ask gaming related questions (AHK v1.1 and older)
genjuro
Posts: 43
Joined: 06 Jun 2020, 23:25

Please help me complete this script

Post by genjuro » 29 Nov 2021, 14:44

I need the script to do the following. While I'm holding down rbutton the scrip should almost immediatly press d and after a short while also press r AND meanwhile also hold down rbutton.
The one I have is working somewhat but I fail to succesfully imlement the part where d gets pressed.

Anyone around who can help ?

Thanks !

Code: Select all

~rbutton::
KeyWait, RButton, T.3
while (GetKeyState("rbutton", "P"))
{
	SendInput, {r}
	Sleep,	50
}
return

User avatar
mikeyww
Posts: 26612
Joined: 09 Sep 2014, 18:38

Re: Please help me complete this script

Post by mikeyww » 29 Nov 2021, 14:51

Code: Select all

~RButton::
SetKeyDelay, 40
While GetKeyState("RButton", "P")
 Send dr
Return

genjuro
Posts: 43
Joined: 06 Jun 2020, 23:25

Re: Please help me complete this script

Post by genjuro » 29 Nov 2021, 14:58

Thanks but can't use it this way because it spam both rapidly. I need to give a better description to give sorry.
So while I held down rbutton after 0.3 sec it should press d and after 0.5 sec it should press r and repeat it in 3 sec.

Can you please modify it this way ?

Thank you sir!

User avatar
mikeyww
Posts: 26612
Joined: 09 Sep 2014, 18:38

Re: Please help me complete this script

Post by mikeyww » 29 Nov 2021, 15:43

Code: Select all

~RButton::
Outer:
Loop, 2 {
 For letter, wait in {d: 0.3, r: 0.2} {
  KeyWait, RButton, T%wait%
  If ErrorLevel
   Send %letter%
  Else Break, Outer
 }
 If (A_Index = 1)
  Loop, 6
   Sleep, 500 * GetKeyState("RButton", "P")
  Until !GetKeyState("RButton", "P")
}
SoundBeep, 1500
Return

genjuro
Posts: 43
Joined: 06 Jun 2020, 23:25

Re: Please help me complete this script

Post by genjuro » 29 Nov 2021, 16:14

perfect as always thanks :)

Post Reply

Return to “Gaming Help (v1)”