Like I had said earlier:
1) Create a screen hook
2) Use object recognition to determine where you want simulated mouse clicks to happen or what events to use
If you want clientless bots:
1) Get a copy of the controler *.dll files
2) Decompile these into ASM code or find someone who was nice enough to already generate the code for them.
3) Figure out what needs to be injected into the *.dll files to achieve the result you desire
4) Recompile the *.dll files back down and run your app using the controller dll's. Pretty much if you use the DLL approach you need to do a lot of decompiling and trial and error. Sometimes even down to registry editing and modification with a HEX tool. But then you create a way to fire the updated controls with the dll and make it start influencing the game. In games such as D2 you can use d2jsp to control these DLL hooks with a top side script and control character movement without simulating mouse clicks.
:-)
Hope that helps a bit in your research.