At the moment i am trying to write a script which would help me in a game. I want it to look for special bases on the map in the game Goodgame Empire (i attached pictures of it to this post). I am looking for free food bases (not castles). Occupied bases look almost the same but they have a flag and small tents around and are for the moment not what i am looking for.
I tried to do it on my own but i failed. Either the ImageSearch command is not accurate enough or i am failing miserably. I was using a png of the free base with tranparent background for the script. As soon as i tested the script and opened the image in Paint and made the background for example black it didnt recognize it. The script and the image are saved in the same folder on my pc by the way. As you can see in the map picture i attached there is also some kind of background ingame which doesnt make it easier.
After the script searched on the current screen for the image it should press the right arrow for lets say one second (to got to the right on the map) and look for a free base again.
Is there anyone who can help me improving my script?
Thats what i have done so far:
Code: Select all
^j::
CoordMode, Pixel
IfNotExist, rsdfuttertrans.png
MsgBox Error: Your file either doesn't exist or isn't in this location.
lookForIns:
Loop{
ImageSearch, x, y, 0, 0, A_ScreenWidth, A_ScreenHeight, *50 rsdfuttertrans.png
SoundBeep, 200, 400
send, {right down}
sleep, 1000
send, {right up}
}
until, ErrorLevel = 0
MsgBox The picture has been found at %x%x%y%.
SoundBeep, 400, 200
sleep, 100
SoundBeep, 400, 200
ExitApp
Return
^h::
SoundBeep, 150, 1000
ExitApp
Return
hanslhansl