In the first part, I would like to define the variables such as what colors will be used. Then would be the main script as "run function1, then run function2. Run function1 again, then func2. When function1 doesnt find color, run Function3. As explained here:
Heres an example of what the script would be doing:
Toggle for looping (looping on, looping off). When toggled "on" it would loop as long as its turned off.
Function1 = Find harvestable resource (based on colors, with pixelsearch). When found, advance to function2. When not found, advance to function3.
Function2 = Harvest available resource (for Function2, I need to obtain the X and Y coordinates, for whatever color it was that found, in the priority order I explained earlier)
Function3 = Move to another spot, then begin Function1.
Perhaps even, when Function1 has advanced to Function3 skipping Function2 X times, it would sleep for a while (like 5 minutes) then begin again.
Here's what I've tried to do.. I cant seem to figure out the syntax of AHK.. If one could help me figuring out how to do the PixelSearch part, I think I can manage the rest myself.
Code: Select all
Colors := [0xFBAF00, 0x150088, 0x4CB122]
Found := 0
^F5::
{
Loop, % Colors.MaxIndex() {
WinActivate, Untitled - Paint
PixelSearch, PosX, PosY, 230, 240, 550, 540, % Colors[A_Index], 3, fast
if (!ErrorLevel)
Found = 1
}
if Found {
MsgBox, One or more colors within 3 shades of variation was found at X%PosX% Y%PosY%.
}
else
MsgBox, Colors not found in the specified region.
}
return