Need Help, Not Finding Image

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
brewhaha
Newbie
Posts: 2
Joined: Wed May 29, 2019 11:15 pm

Need Help, Not Finding Image

Post by brewhaha » Wed May 29, 2019 11:31 pm

I am using this program to run macros in a game. The macro is supposed to find an image that pops up randomly, when it does, left click image, then after that I can insert a recorded session of what to do after that. So far, I open the game screen, left click an arrow to center the screen, right click to zoom out, then it is supposed to find the image, which there are several on screen, then left click etc. After the right click I hear a windows ring sound then that's it. It does not click on image.

//Set IGNORESPACES to 1 to force script interpreter to ignore spaces.
//If using IGNORESPACES quote strings in {" ... "}
//Let>IGNORESPACES=1
// C:\Users\michael\AppData\Local\Temp\msrF64B.scp
// Recorded on Wednesday, May 29, 2019, at 06:55 PM

//Recorded Events
Let>WW_TIMEOUT=5
CapsOff
MouseMove>629,746
Wait>1.878
//Clicking on:
//SnapShotFile>%BMP_DIR%snapshot_0.png
Wait>0.047
LClick
Wait>0.141
//Activating Window:
//SnapShotFile>%BMP_DIR%snapshot_1.png
WaitWindowOpen>Stronghold Kingdoms - China 1
MoveWindow>Stronghold Kingdoms - China 1,-8,-8
ResizeWindow>Stronghold Kingdoms - China 1,1382,784
Wait>0.281
MouseMove>933,65
Wait>2.62
LClick
Wait>0.203
MouseMove>641,418
Wait>3.412
RClick
Wait>0.985
ScreenCapture>770,571,380,266,%TEMP_DIR%\screenrect.bmp
//Find and Left Click Center of
FindImagePos>%BMP_DIR%\image_1.bmp,%TEMP_DIR%\screenrect.bmp,0,1,XArr,YArr,NumFound,EXACT
If>NumFound>0
MouseMove>{%XArr_0%+770},{%YArr_0%+571}
wait>3
LClick
Endif

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1389
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Need Help, Not Finding Image

Post by Dorian (MJT support) » Fri May 31, 2019 9:50 am

Just a couple of things to eliminate a few possibilities.

You're using EXACT. Are you completely sure the image is always the same?

How static is the image? Using image recognition on the entire screen can be time consuming. Have you tried just searching in the game window, or specific co-ordinates?
Yes, we have a Custom Scripting Service. Message me or go here

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts