making a simple bot

ok, so i got bored today, and came across a really simply flash game:
http://dagobah.net/flash/Cursor_Invisible.swf
my question is:

what would it require to make a simple bot for this game?

conceptually, the program sounds really easy.

since the plate you're supposed to click on in the game resemble nothing else, i should just be able to do a search for a single pixel that meets the r g b criteria and then move the mouse to those coordinates, and then synthesize a mouse click. i really just don't have any knowledge of the best methods to do all this.

it'd be really nice if someone could give me some help just so i could get my foot in the door in this area.
Well, never really done anything like that. I suppose you should look into Windows API (I assume you work on Windows). Maybe something like this would work:

1) Find a window of interest (EnumWindows).
2) Get the device context of thie window (GetWindowDC).
3) Analyse window image to find the right place to click (GetPixel???).
4) Send the appropriate mouse events to simulate mouse move and click (PostMessage).
what exactly is a device context? i'm not terribly familiar with vc++
also, GetPixel() doesn't return a location of a certain pixel, i don't believe. so that might not be useful for making a bot seeing as i need a function to search for a specific pixel and then return a location value, so that i can simulate mouse inputs.
I wouldn't use PostMessage on a windows machine
For simplicity's sake a better method (imho) is SetCursorPos(xpos,ypos);

For the bot, just set up the boundaries and make a little collision grid

[]--[]--[]--[]--[]
|....|....|....|....|
[]--[]--[]--[]--[]
|....|....|....|....|
[]--[]--[]--[]--[]
|....|....|....|....|
[]--[]--[]--[]--[]

getpixel under those collision points and if the value is more white than black, click. easy peasy.
getpixel() doesn't return a location though.. so i wouldn't know where to set the cursor position.
Topic archived. No new replies allowed.