Pixelsearch mistery Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
VetX
Posts: 5
Joined: 25 Apr 2022, 11:37

Pixelsearch mistery

Post by VetX » 06 Oct 2022, 12:28

Im as confused as i can be, i want it to perform an action after on or other pixelcolor has been found but it either works twice or doesnt work at all, i don't mind the code being messy, i just want it to work because i've been at it for an hour now :evil:

Code: Select all

Colors1 := "0xE5464F|0xCA3843"
Colors2 := "0x31E190|0x51E5A0|0x31E08F|0x50E59F|0x50E49F|0x32E190|0x50E5A0|0x32E190"
F7::
Start:
MyVar := 0
send, {e Down}
sleep, 75
send, {e up}
sleep, 150
send, {j Down}
sleep, 75
send, {j up}
Loop, 30
{
PixelSearch, x, y, 763, 613, 765, 615, %Colors1%, 10
if (ErrorLevel = 0)
{
SoundBeep, 750, 500
sleep, 250
Send, {BACKSPACE}
Send, {BACKSPACE}
Random, rand, 10000, 15000
Sleep, %rand%
Click, Down, 1093 493
Click, Up, 1135 493
sleep, 300
send ^c
sleep, 400
Click, 767, 558
sleep, 400
Send ^v
Sleep 1000
Click, 767, 558
sleep, 300,
Click, 851, 619
sleep, 500
MyVar := (MyVar + 1)
send, {e Down}
sleep, 75
send, {e up}
send, {e Down}
sleep, 75
send, {e up}
send, {j Down}
sleep, 75
send, {j up}
}
PixelSearch, x, y, 1004, 1037, 1010, 1039, %Colors2%, 30
if (ErrorLevel = 0)
{
MyVar := (MyVar + 1)
if (MyVar > 19)
{
sleep, 260000
goto, Start
}
else {
Random, rand, 651, 700
Sleep, %rand%
send, {e Down}
sleep, 75
send, {e up}
sleep, 75
send, {e Down}
sleep, 75
send, {e up}
sleep, 750
send, {j Down}
sleep, 75
send, {j up}
MyVar := (MyVar + 1)
sleep, 6500
}
 }
  }

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

Re: Pixelsearch mistery  Topic is solved

Post by mikeyww » 06 Oct 2022, 13:14

Hi,

You can test a new two-line script, so that you can get the search working before you add more actions based on the results. The first line of your script will be the search. In the second line, display the ErrorLevel.

Unfortunately, you have to use AHK's syntax instead of making up your own. A PixelSearch will accept a single color, with or without a variation parameter. See the documentation. You can execute as many sequential searches as you like.

Post Reply

Return to “Ask for Help (v1)”