My code no longer works.. weird

Ask gaming related questions (AHK v1.1 and older)
adrenalinskr
Posts: 17
Joined: 02 Dec 2016, 13:27

My code no longer works.. weird

31 Aug 2019, 00:14

Ok. Attached is my code that changed with some sort of update.. no idea.

Here is my code:

$g::
SetKeyDelay, 30,

{
{
Send, {g Down}
sleep 60
Send, {g Up}
}
}

return

F2::Suspend

My problem is... It spams "g" in text editor.. but in game.. it like rapid fires it and it doesnt hold down for a split second. I can get it to work when I put the sleep to 80 and the setkeydelay to 80 as well... however.. it is to slow. When I lower it to 65 for both.. it rapid fires again and doesnt work.

If I take out SetKeyDelay, it doesnt work. I also tried SetKeyDelay 65, "duration", "play" -- "had numbers, etc"
If I take out sleep, it doesnt work.
I tried a loop, doesnt work.

Can anyone help me out?
User avatar
Dumitas
Posts: 167
Joined: 14 Dec 2017, 21:32

Re: My code no longer works.. weird

31 Aug 2019, 00:31

Remove the keydelay and divide the times like this:

Code: Select all

$g::
	Send, {g Down}
	sleep 40
	Send, {g Up}
	sleep 20
return
F2::Suspend
Play with those times instead, because from Up to Down, there is no sleep time. Meaning, you are pressing immediately after the release.
Image
adrenalinskr
Posts: 17
Joined: 02 Dec 2016, 13:27

Re: My code no longer works.. weird

31 Aug 2019, 00:56

Dumitas wrote:
31 Aug 2019, 00:31
Remove the keydelay and divide the times like this:

Code: Select all

$g::
	Send, {g Down}
	sleep 40
	Send, {g Up}
	sleep 20
return
F2::Suspend
Play with those times instead, because from Up to Down, there is no sleep time. Meaning, you are pressing immediately after the release.
So it somewhat works.. when i put the g Down sleep to 180. However, that is way to slow. When I lower it below 160.. it just rapid fires it.

The game I play on.. must have changed something. It worked really well and now it needs a bigger delay... but it isnt fast enough. Anything I can do?
adrenalinskr
Posts: 17
Joined: 02 Dec 2016, 13:27

Re: My code no longer works.. weird

31 Aug 2019, 08:43

Anyone have any ideas?

It's like.. as soon as I drop below a certain ms.... the game no longer registers that click. It just tap tap taps and it doesnt move as it should.
User avatar
Dumitas
Posts: 167
Joined: 14 Dec 2017, 21:32

Re: My code no longer works.. weird

31 Aug 2019, 09:31

You need it to happen once? Can you explain what you need this script exactly for?
Image
adrenalinskr
Posts: 17
Joined: 02 Dec 2016, 13:27

Re: My code no longer works.. weird

31 Aug 2019, 10:52

Dumitas wrote:
31 Aug 2019, 09:31
You need it to happen once? Can you explain what you need this script exactly for?
I play the game Scum. -- I dont need it to happen once. I need it to simulate that I am tapping "f". Dowwn, up, down up, down, up. But with some new patch, the script only works with a bigger delay... but.. that delay is to big, causing time to run out. The code you provided me, just simulates tapping, but doesnt register as if I am holding it down for a second.
User avatar
Dumitas
Posts: 167
Joined: 14 Dec 2017, 21:32

Re: My code no longer works.. weird

31 Aug 2019, 11:54

It should work with a bigger delay because a second its 1000ms, you need to increase the Sleep time.
Image
adrenalinskr
Posts: 17
Joined: 02 Dec 2016, 13:27

Re: My code no longer works.. weird

31 Aug 2019, 12:21

Dumitas wrote:
31 Aug 2019, 11:54
It should work with a bigger delay because a second its 1000ms, you need to increase the Sleep time.
I understand.. if I do it manually by hand.. it equates to about 250ms.. give or take. When I put it into the script.. it doesnt respond the way I need it to. I have 4 seconds to complete an action. The delay is too long. When I had it at ~60ms, it was perfect, until new update.
User avatar
Dumitas
Posts: 167
Joined: 14 Dec 2017, 21:32

Re: My code no longer works.. weird

31 Aug 2019, 12:29

Try with SendInput instead. :think:

Also elevate the script / Run as admin.
Image
adrenalinskr
Posts: 17
Joined: 02 Dec 2016, 13:27

Re: My code no longer works.. weird

31 Aug 2019, 15:30

Dumitas wrote:
31 Aug 2019, 12:29
Try with SendInput instead. :think:

Also elevate the script / Run as admin.
I dont really know what I am doing with send input.. ill give it a try. does it work differently?

I tried running as admin, same thing.

I do really appreciate the help.
User avatar
Dumitas
Posts: 167
Joined: 14 Dec 2017, 21:32

Re: My code no longer works.. weird

31 Aug 2019, 16:22

SendInput
SendInput is generally the preferred method to send keystrokes and mouse clicks because of its superior speed and reliability
If that's the game somehow blocking that, try to compile it.
Image
adrenalinskr
Posts: 17
Joined: 02 Dec 2016, 13:27

Re: My code no longer works.. weird

31 Aug 2019, 17:24

Dumitas wrote:
31 Aug 2019, 16:22
SendInput
SendInput is generally the preferred method to send keystrokes and mouse clicks because of its superior speed and reliability
If that's the game somehow blocking that, try to compile it.
I feel crappy asking.. but I dont even know where to start writing a SendInput script. Anyway you can write me a g Down, g Up? or is it just that simple?

$g::

SendInput {g Down}
Sleep 80
Return

Something of that nature?
User avatar
Dumitas
Posts: 167
Joined: 14 Dec 2017, 21:32

Re: My code no longer works.. weird

31 Aug 2019, 20:27

Just replace the Send for SendInput.
Image
adrenalinskr
Posts: 17
Joined: 02 Dec 2016, 13:27

Re: My code no longer works.. weird

01 Sep 2019, 07:20

Dumitas wrote:
31 Aug 2019, 20:27
Just replace the Send for SendInput.
Like this?

$g::


{
{
SendInput, {g Down}
sleep 120
SendInput, {g Up}
}
}

return

F2::Suspend
User avatar
Dumitas
Posts: 167
Joined: 14 Dec 2017, 21:32

Re: My code no longer works.. weird

01 Sep 2019, 07:26

Yes, and with less brackets, not mandatory but unnecessary.
Image

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: Rxbie and 54 guests