Ok, so long story short, I am just trying to pick up some knowledge on Java. I am learning Java for a specific project, but I need some help on some stuff that no tutorials on the net seem to cover.
At the moment, I only need to know how to 2 different things that I canít find anywhere else (nor do I know what to Google to try to find a guide on them as I donít know exactly how to go about doing it).
What I am attempting to do is to write a very simple macro/bot for an MMO, what I need the bot to do is check that something is present (in this case it is a wreck), I need this program to check a specific pixel location, and if it is white do one thing, if its black, do another. I could find the exact hex code for the color I need it to check for and all that and I know how to make the IF statement and the functionality for what it would do after that, but I donít know how to write the function where the bot checks what color that pixel is. It is a picture as well, so I could take a screenshot and have it check for the entire picture (it is only probably 5px by 5px). To sum this question up, how to I make the program check pixel location ( x , y ) to see if it is color (#xxxxxx) or if it is color (#yyyyyy) at which point I would make an IF statement to do one thing (what I want it to do) if the pixel is (#xxxxxx) or go somewhere else and check again if it is (#yyyyyy). I keep rambling but all in all I need it to check ( x , y ) for what color that pixel is.
Secondly, the game I am writing this for displays the distance between you and the selected item in KM in 2 spots consistently, and I need it to approach (simple as double clicking it) if the distance is greater than a certain number (50 for example), or do something else if the selected entity is greater than 50 KM. For this, the program would have to check those two locations and be able to convert the image to a number, as it isnít anything you can copy, it is just displayed. So how would I have it convert a displayed number to a number I could use to define the distance and write another IF/THEN statement for if distance>x and for x>distance. Could anyone point me toward a script that will do this or tell me how at all?
Those are my two questions for now that I canít seem to find anywhere else, though I am sure that I will find another 100 questions before I am done with this. Any help with these two would be greatly appreciated. Thanks!
Re: Beginner Question
The Robot class can create a BufferedImage screenshot. The BufferedImage can give you the pixel value of a particular coordinate. The API is your friend: Java Platform SE 6
I think what you're talking about in the second part has something to do with image recognition or OCR, which is actually a really complicated field. I'd try looking for a third party library that does what you're looking for.