Hi,
I'm currently working on a bot for a game.
It works like this:
1: Take a picture of the current playing field
2: Do the calculations on what i gotta do (best move)
3: Use sendmessage to send a mouseclick to the game at the correct position
I do this about every 2nd second.
Most of the time its working like a charm However there is a certain instance where the game pops up a break window (its just an image in front of the playing field, showing current scores) every 5-6 minutes, its random. If my program starts a loop and does step 1, then the break window "pops up" before it's done with step 2 and 3, my mouse gets stuck.
It moves the pointer and clicks (onto the break window which has no effect), but once the break is over, the mouse just stays stuck, while my program keeps up the process of getting the picture, calculating and sending the clicks.
If i, once its stuck, move my mouse just a little, everything is resolved and it can keep going until it gets stuck again.
My question is: Is there any way this is happening because of the SendMessage i use? I've tried using mouse_event instead, but its the same.
The main handle of the window (the handle i send with the SendMessage) doesn't change when the break box pops up.
The chances of this happening is very slim, but it's still very annoying since i cant leave my computer as it destroys my score when i gets stuck for hours.
If anyone have any idea as to why this is happening, please help me.
Sincerly, Drizz
Edit: I tried switching to postmessage instead, it seems to help somewhat. I was only able to replicate the error 1/10 times vs 6-7/10 with sendmessage.. This might just be random tho. Any explanation as to why?
I'm currently working on a bot for a game.
It works like this:
1: Take a picture of the current playing field
2: Do the calculations on what i gotta do (best move)
3: Use sendmessage to send a mouseclick to the game at the correct position
I do this about every 2nd second.
Most of the time its working like a charm However there is a certain instance where the game pops up a break window (its just an image in front of the playing field, showing current scores) every 5-6 minutes, its random. If my program starts a loop and does step 1, then the break window "pops up" before it's done with step 2 and 3, my mouse gets stuck.
It moves the pointer and clicks (onto the break window which has no effect), but once the break is over, the mouse just stays stuck, while my program keeps up the process of getting the picture, calculating and sending the clicks.
If i, once its stuck, move my mouse just a little, everything is resolved and it can keep going until it gets stuck again.
My question is: Is there any way this is happening because of the SendMessage i use? I've tried using mouse_event instead, but its the same.
The main handle of the window (the handle i send with the SendMessage) doesn't change when the break box pops up.
The chances of this happening is very slim, but it's still very annoying since i cant leave my computer as it destroys my score when i gets stuck for hours.
If anyone have any idea as to why this is happening, please help me.
Sincerly, Drizz
Edit: I tried switching to postmessage instead, it seems to help somewhat. I was only able to replicate the error 1/10 times vs 6-7/10 with sendmessage.. This might just be random tho. Any explanation as to why?
Comment