I'm trying to automate a somewhat simple elimination process and am having an issue with the ability to finish a set of colors before the previous set of colors respawns and interrupts.
Elimination of these colored circles takes an unpredictable amount of time varying between instantly - 6sec~
Example 1:
This is what the set up looks like initially. Every time I eliminate one circle(starting with green for example), they'll stay gone for a short period of time.
The red signal circle is something I have set up to let me know whenever I finish eliminating a circle and my script will look for that signal in order to move on to the next circle.
Example 2:
This is an example of what my issue is. After eliminating some of the colors(this can happen out of order), when I'm mid way through one of the other sets, the sets prior begin to respawn.
In my script, after the red signal tells me I eliminated a circle and to move to the next, this will pull my attention away from finishing the remaining of the same color(ignoring yellow and going back to green).
Though I don't know the solution through code, my ideas to remedy this would be the ability to potentially prevent me from going back to a previous set of colors until the set of colors I'm currently eliminating are completely gone(or undetectable by script).
Any suggestions to solve any or all of the following issues would be helpful.
1: The primary issue of finishing a set of colors before moving back to a previous set.
2: Being able to immediately go to next circle without the red signal
3: A better way to organize the code or streamline it. I'm still new but as it currently runs it works pretty much fine other than issue 1.
Snippet of my current code where everything mentioned above takes place:
Code: Select all
loop {
PixelSearch, Px, Py, RedBox1, RedBox2, RedBox3, RedBox4, 0x0000FF, 1, Fast
if (ErrorLevel = 0) {
PixelSearch, Px, Py, Screen1, Screen2, Screen3, Screen4, 0x00FF00, 1, Fast
if (ErrorLevel = 0) {
PixelSearch, Px, Py, Screen1, Screen2, Screen3, Screen4, 0x00FF00, 1, Fast
Random, Rx, 2, 6
Random, Ry, 2, 6
MouseMove, Px+Rx, Py+Ry, 3
click
}
else if (ErrorLevel != 0) {
PixelSearch, Px, Py, Screen1, Screen2, Screen3, Screen4, 0x00FF88, 1, Fast
if (ErrorLevel = 0) {
PixelSearch, Px, Py, Screen1, Screen2, Screen3, Screen4, 0x00FF88, 1, Fast
Random, Rx, 2, 6
Random, Ry, 2, 6
MouseMove, Px+Rx, Py+Ry, 3
click
}
else if (ErrorLevel != 0) {
PixelSearch, Px, Py, Screen1, Screen2, Screen3, Screen4, 0x0088FF, 1, Fast
if (ErrorLevel = 0) {
PixelSearch, Px, Py, Screen1, Screen2, Screen3, Screen4, 0x0088FF, 1, Fast
Random, Rx, 2, 6
Random, Ry, 2, 6
MouseMove, Px+Rx, Py+Ry, 3
click
}