Need help optimizing POE script (Stutter / Consistency issues)

Ask gaming related questions (AHK v1.1 and older)
Commissioned
Posts: 13
Joined: 14 Oct 2022, 12:25

Need help optimizing POE script (Stutter / Consistency issues)

Post by Commissioned » 02 Jun 2023, 20:11

My script is supposed to spam loop, but I have one issue. When I spam the script, the first time it loops it always has a really long 200ms delay, this only happens during the first loop, during the "Return". I'm mainly trying to find a way to fix this, but I also have one other small issue. The script seems to vary widely between each loop, is there anything I can do to make the script more consistent in the time between loops? I don't mind the script being faster or slower overall, as long as the speed is consistent. Thanks friends.

Code: Select all

#NoEnv
#MaxHotkeysPerInterval 99000000
#HotkeyInterval 99000000
#KeyHistory 0
ListLines Off
Process, Priority, , A
SetBatchLines, -1
SetKeyDelay, -1, -1
SetMouseDelay, -1
SetDefaultMouseSpeed, 0
SetWinDelay, -1
SetControlDelay, -1
SendMode Input
DllCall("ntdll\ZwSetTimerResolution","Int",5000,"Int",1,"Int*",MyCurrentTimerResolution)



#IfWinActive, ahk_exe PathOfExile.exe

e::
{
SendInput, ew
PixelSearch, Px, Py, 1619, 967, 1619, 967, 0x6A6968
if (ErrorLevel=1)
 {
SendInput, 8
 }
PixelSearch, Px, Py, 313, 1080, 313, 1080, 0x99D7F9
if (ErrorLevel=1)   
         one := true
    else
         one := false
   
PixelSearch, Px, Py, 332, 1061, 332, 1061, 0x43762F
if (ErrorLevel=0)  
         two := true
    else
         two := false
   If (one) and (two)
   {
SendInput, 9
   }
PixelSearch, Px, Py, 358, 1080, 358, 1080, 0x99D7F9
if (ErrorLevel=1)   
         one := true
    else
         one := false 
PixelSearch, Px, Py, 377, 1059, 377, 1059, 0x4EB82C
if (ErrorLevel=0)  
         two := true
    else
         two := false
   If (one) and (two)
   {
SendInput, 2
   }
PixelSearch, Px, Py, 403, 1080, 403, 1080, 0x99D7F9
if (ErrorLevel=1)   
         one := true
    else
         one := false   
PixelSearch, Px, Py, 423, 1061, 423, 1061, 0x499228
if (ErrorLevel=0) 
         two := true
    else
         two := false
   If (one) and (two)
   {
SendInput, 6
   }
PixelSearch, Px, Py, 448, 1080, 448, 1080, 0x99D7F9
if (ErrorLevel=1)  
         one := true
    else
         one := false   
PixelSearch, Px, Py, 472, 1063, 472, 1063, 0x1515A9
if (ErrorLevel=0)  
         two := true
    else
         two := false
   If (one) and (two)
   {
SendInput, 7
   }
PixelSearch, Px, Py, 493, 1080, 493, 1080, 0x99D7F9
if (ErrorLevel=1)   
         one := true
    else
         one := false   
PixelSearch, Px, Py, 505, 1059, 505, 1059, 0x774C3F
if (ErrorLevel=0)   
         two := true
    else
         two := false
   If (one) and (two)
   {
SendInput, 3
   }
  SendInput, w
      DllCall("Sleep","UInt",70)  
  SendInput, w
     DllCall("Sleep","UInt",65)
}
return
This is what it looks like when I hold it down for 3 runs, it will have a long delay during the first "Return", then spams normally at a consistent-ish rate.
Spoiler

[Mod edit: Added spoiler tags so everyone wouldn’t have to scroll forever to get to the next post.]

Rohwedder
Posts: 7551
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Need help optimizing POE script (Stutter / Consistency issues)

Post by Rohwedder » 03 Jun 2023, 03:47

Hallo,
perhaps? Replace:

Code: Select all

e::
{
by:

Code: Select all

$e::
While, GetKeyState("e","P")
{

Commissioned
Posts: 13
Joined: 14 Oct 2022, 12:25

Re: Need help optimizing POE script (Stutter / Consistency issues)

Post by Commissioned » 03 Jun 2023, 23:14

Rohwedder wrote:
03 Jun 2023, 03:47
Hallo,
perhaps? Replace:

Code: Select all

e::
{
by:

Code: Select all

$e::
While, GetKeyState("e","P")
{
Thank you so much. Works perfectly.

Post Reply

Return to “Gaming Help (v1)”