POE Script. Cast once every 8 seconds.

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

POE Script. Cast once every 8 seconds.

Post by Commissioned » 02 Apr 2023, 00:30

Right now I am using this

Code: Select all

~q::
{
PixelSearch, Px, Py, 1795, 1044, 1795, 1044, 0x6A300B, 3, Fast
if (ErrorLevel=1)
 {
Send, 7
Send, 3
 }
PixelSearch, Px, Py, 133, 1040, 133, 1041, 0x130D54, 3, Fast
if (ErrorLevel=1)
 {
Send, 2
Send, 6
 }
}
Return
What I want to do is add the ability for this to trigger a press of the "8" key once every 9 seconds. I would be able to spam Q for the above code to trigger, but while spamming Q, once every 9 seconds a Q press will also be allowed to send the "8" key once, but for 9 seconds after it will not 8 when pressed.

[Mod edit: Moved topic to v1 help, based on posted code.]

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

Re: POE Script. Cast once every 8 seconds.

Post by mikeyww » 02 Apr 2023, 06:43

Test in Notepad.

Code: Select all

#Requires AutoHotkey v1.1.33
Global on

#If !on
~q::
Critical
SetTimer find, 25
SetTimer eight, 9000
find(), eight(), on := True
SoundBeep 1500
Return
#If

~q Up::
SetTimer find, Off
SetTimer eight, Off
on := False
SoundBeep 1000
Return

find() {
 PixelSearch ,,, 1795, 1044, 1795, 1044, 0x6A300B, 3, Fast
 Send % ErrorLevel && on ? 73 : ""
 If on {
  PixelSearch ,,, 133, 1040,  133, 1041, 0x130D54, 3, Fast
  Send % ErrorLevel && on ? 26 : ""
 }
}

eight() {
 Send 8
}

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

Re: POE Script. Cast once every 8 seconds.

Post by Commissioned » 03 Apr 2023, 02:27

mikeyww wrote:
02 Apr 2023, 06:43
Test in Notepad.

Code: Select all

#Requires AutoHotkey v1.1.33
Global on

#If !on
~q::
Critical
SetTimer find, 25
SetTimer eight, 9000
find(), eight(), on := True
SoundBeep 1500
Return
#If

~q Up::
SetTimer find, Off
SetTimer eight, Off
on := False
SoundBeep 1000
Return

find() {
 PixelSearch ,,, 1795, 1044, 1795, 1044, 0x6A300B, 3, Fast
 Send % ErrorLevel && on ? 73 : ""
 If on {
  PixelSearch ,,, 133, 1040,  133, 1041, 0x130D54, 3, Fast
  Send % ErrorLevel && on ? 26 : ""
 }
}

eight() {
 Send 8
}
Tried messing with this as it was close, but still couldn't get it. This seems to work if I hold the Q key down, but if I spam the Q key, it still spams 8 with every Q press.

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

Re: POE Script. Cast once every 8 seconds.

Post by mikeyww » 03 Apr 2023, 05:46

I see. This may help.

Code: Select all

#Requires AutoHotkey v1.1.33
Global on

~q Up::SetTimer qDone, -1000

#If !on
~q::
SetTimer find, 25
SetTimer eight, 9000
find(), eight(), on := True
SoundBeep 1500
Return
#If

qDone() {
 If !GetKeyState("q", "P") {
  SetTimer find, Off
  SetTimer eight, Off
  on := False
  SoundBeep 1000
 }
}

find() {
 PixelSearch ,,, 1795, 1044, 1795, 1044, 0x6A300B, 3, Fast
 Send % ErrorLevel && on ? 73 : ""
 If on {
  PixelSearch ,,, 133, 1040,  133, 1041, 0x130D54, 3, Fast
  Send % ErrorLevel && on ? 26 : ""
 }
}

eight() {
 Send 8
}

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

Re: POE Script. Cast once every 8 seconds.

Post by Commissioned » 03 Apr 2023, 09:58

Works perfectly. Thanks brother.

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

Re: POE Script. Cast once every 8 seconds.

Post by Commissioned » 04 Apr 2023, 07:04

mikeyww wrote:
03 Apr 2023, 05:46
I see. This may help.
Mind if I steal your brain one more time friend? How would I go about adding to the script a press of the "R" key with every Q press? I thought it would be simply adding "send, r" but I'm putting it in a wrong location in the script. Tried multiple different spots to put it, but it always seemed to get caught in the delayed "8" code. Thanks again for the previous script, it's been working great.

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

Re: POE Script. Cast once every 8 seconds.

Post by mikeyww » 04 Apr 2023, 07:12

Code: Select all

#Requires AutoHotkey v1.1.33
Global on

~q::r
~q Up::SetTimer qDone, -1000

#If !on
~q::
Send r
SetTimer find, 25
SetTimer eight, 9000
find(), eight(), on := True
SoundBeep 1500
Return
#If

qDone() {
 If !GetKeyState("q", "P") {
  SetTimer find, Off
  SetTimer eight, Off
  on := False
  SoundBeep 1000
 }
}

find() {
 PixelSearch ,,, 1795, 1044, 1795, 1044, 0x6A300B, 3, Fast
 Send % ErrorLevel && on ? 73 : ""
 If on {
  PixelSearch ,,, 133, 1040,  133, 1041, 0x130D54, 3, Fast
  Send % ErrorLevel && on ? 26 : ""
 }
}

eight() {
 Send 8
}

Post Reply

Return to “Gaming Help (v1)”