Code: Select all
Let>k=0
Let>db=0
while>k=0
Wait>0.02
FindImagePos>C:\Users\Win\Desktop\kep2.png,SCREEN,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
MouseMove>XArr_0,YArr_0
LClick
Wait>0.25
Let>db=db+1
Message>%db%
FindImagePos>C:\Users\Win\Desktop\ok.png,SCREEN,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
MouseMove>XArr_0,YArr_0
Wait>0.25
LClick
Endif
Endif
Wait>0.02
FindImagePos>C:\Users\Win\Desktop\kep1.bmp,SCREEN,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
MouseMove>XArr_0,YArr_0
LClick
MouseMove>0,0
Wait>0.25
Let>db=db+1
Message>%db%
FindImagePos>C:\Users\Win\Desktop\ok.png,SCREEN,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
MouseMove>XArr_0,YArr_0
Wait>0.25
LClick
Endif
Endif
Wait>0.05
FindImagePos>C:\Users\Win\Desktop\kep6.png,SCREEN,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
MouseMove>XArr_0,YArr_0
LClick
MouseMove>0,0
Wait>0.25
Let>db=db+1
Message>%db%
FindImagePos>C:\Users\Win\Desktop\ok.png,SCREEN,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
MouseMove>XArr_0,YArr_0
Wait>0.25
LClick
Endif
Endif
Wait>0.02
FindImagePos>C:\Users\Win\Desktop\kep3.bmp,SCREEN,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
MouseMove>XArr_0,YArr_0
LClick
MouseMove>0,0
Wait>0.25
Let>db=db+1
Message>%db%
FindImagePos>C:\Users\Win\Desktop\ok.png,SCREEN,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
MouseMove>XArr_0,YArr_0
Wait>0.25
LClick
Endif
Endif
Wait>0.02
FindImagePos>C:\Users\Win\Desktop\kep7.png,SCREEN,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
MouseMove>XArr_0,YArr_0
LClick
MouseMove>0,0
Wait>0.25
Let>db=db+1
Message>%db%
FindImagePos>C:\Users\Win\Desktop\ok.png,SCREEN,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
MouseMove>XArr_0,YArr_0
Wait>0.25
LClick
Endif
Endif
Wait>0.02
FindImagePos>C:\Users\Win\Desktop\kep5.png,SCREEN,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
MouseMove>XArr_0,YArr_0
LClick
MouseMove>0,0
Wait>0.25
Let>db=db+1
Message>%db%
FindImagePos>C:\Users\Win\Desktop\ok.png,SCREEN,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
MouseMove>XArr_0,YArr_0
Wait>0.25
LClick
Endif
Endif
Wait>0.02
endwhile
It works (or at least should work) as the following: random (of 6) images appear on the screen, the macro finds them and clicks on them, at one time only one image is visible, and when the program clicks on them, they disappear and a new picture will appear in another place.
The problem I am experiencing is that sometimes (it is in a mostly random interval of time, but after about ~30-36 found images) the macro double clicks on the image, instead of the simple one time "LClick", as it was supposed to do. That's a big problem, since if you click twice, at the time of the second click the image would've been already disappeared, so I'd lose the game. I used the second "FindImagePos" inside the first "FindImagePos", so it'd write out the current "click" number, and close the pop-up window after 0.25s, so I could check the value. Each time I fail the game, and restart it, at the first click of the restarted program, the click value is (previous game score)+2, instead of (previous game score)+1, so I am pretty sure the game failed, because it double clicked. At each fail the program won't show the last pop-up, it'd just click on the image and the game would almost immediately fail.
What could be the problem?
Thanks,
Taiga