Code: Select all
loop, 27 {
sleep s1 ;300-450 ms;
pixelsearch, px, py, 506, 197, 527, 65, 0x7A3D09, a, Fast RGB ;a is 0-4;
if (errorlevel = 0){
break
}
}
else if (errorlevel = 1){;do some other stuff that is irrelevant here;}
Code: Select all
loop, 27 {
sleep s1 ;300-450 ms;
pixelsearch, px, py, 506, 197, 527, 65, 0x7A3D09, a, Fast RGB ;a is 0-4;
if (errorlevel = 0){
break
}
}
else if (errorlevel = 1){;do some other stuff that is irrelevant here;}
Code: Select all
try = 0
Loop {
Sleep, 200
PixelSearch,,, 506, 197, 527, 65, 0x7A3D09, 1, Fast RGB
try := ErrorLevel ? try + 1 : 0
ToolTip, %try%
} Until (try = 27)
ToolTip
Send Done
Return
Thx for your response, although im not so sure how to change this for my case. Does row 5 mean that everytime errorlevel 1 happends it adds +1 to "try" variable? When i tested the script it worked cuz the try reseted to 0 quite often but i dont know how to change itmikeyww wrote: ↑23 Jan 2022, 08:32Code: Select all
try = 0 Loop { Sleep, 200 PixelSearch,,, 506, 197, 527, 65, 0x7A3D09, 1, Fast RGB try := ErrorLevel ? try + 1 : 0 ToolTip, %try% } Until (try = 27) ToolTip Send Done Return
In this case, "If ErrorLevel" means "If ErrorLevel is not zero".ErrorLevel is set to 0 if the color was found in the specified region, 1 if it was not found, or 2 if there was a problem that prevented the command from conducting the search.
Nvm, i just had to get to know some of the lines in the script, they where new to me. Thanks for your help.mikeyww wrote: ↑23 Jan 2022, 10:20Yep. If the script works, then why do you want to change it?
What the script does: searches; counts the tries; when pixel is found, resets the tries; when tries reach 27, it continues instead of looping. In other words, "In the loop i want to pixelsearch, if the pixel is found (errorlevel=0) i want to restart the loop, if the pixel is not found in ANY of the 27 loops..."
In this case, "If ErrorLevel" means "If ErrorLevel is not zero".ErrorLevel is set to 0 if the color was found in the specified region, 1 if it was not found, or 2 if there was a problem that prevented the command from conducting the search.