Apparently s.find returns Null if it can't find the image in the region defined, so your code "if(s.find(x))" is not valid java to begin with...
–
AKDADEVILAug 7 '13 at 8:54

I can't help thinking you've bitten off quite a lot. But it depends on the circumstances - do the images you are trying to find appear on some set places, or can they be anywhere on the screen, scaled and rotated?
–
HumungusAug 7 '13 at 8:54

@AKDADEVIL: My code was just like you said.
–
PreformerAug 7 '13 at 8:56

Generally what I do, when writing bots alike these, is to first write a detector system, which detects the coordinates of given images. The system is to fold, first stage is to simply dump a lot of screenshots using the robot class, possibly providing info to the screenshots about the state of the game. Second stage is to analyze the images for occurrences of the images in question, something which can be done by brute force pixel comparison, which is slow truly, but this is something you do before actually developing the not, so I personally think it should just be simple and stupid.
–
SkeenAug 7 '13 at 10:07

Nice idea, what if I have to press an arrow key if an image exists? Also, are there control statements?
–
PreformerAug 7 '13 at 13:14

Its even easier. You simply call press(LEFT) or press(UP) etc. depending on which arrow key you need to press. The full list of Automa's commands can be found at getautoma.com/docs.
–
TytusAug 7 '13 at 13:18

Control statements like If? As this program cant do without them
–
PreformerAug 7 '13 at 13:26

1

Of course you can use control statements. Automa is just a Python library - you can use all the Python language structures (if-statements, while loops, etc.) and its libraries. The Automa commands are simply Python functions and Automa ships with the Python interpreter. Take a look at some advanced usage examples: getautoma.com/examples/addmefast-bot
–
TytusAug 7 '13 at 13:30

I don't know much of Python (null, to be precise). But still, I'll try it. I see # if but where's end if?
–
PreformerAug 7 '13 at 13:31

Figured it out, guys! Seems like the image recognition of sikuli is fuzzy. It wont work with targetImage.setMinRank(1.00) wont work, but when I tried running the program with targetImage.setMinRank(0.99), it all worked fluidly. Thank you for you help.

What format was your target image? If you saved it in a lossy format, a perfect match might be impossible. (Sikuli bug is also possible, but I have used scripts that request a perfect match and worked.)
–
Nathaniel WaisbrotAug 14 '13 at 4:18