Image searching issues

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
gnastie
Newbie
Posts: 5
Joined: Thu May 14, 2020 3:38 am

Image searching issues

Post by gnastie » Fri May 22, 2020 11:52 pm

Alright, so I posted that repeated image searching thing a while back and Marcus, you said to use the "WaitScreenImage" command. I haven't had a problem with the "WaitScreenImage" but I have had a problem with the "FindImagePos". I have used debug, I have looked at the values it's producing or the lack thereof, I tried using exact and correlation coefficients, I tried making an entirely new script and capturing a new image. I can not figure out for the life of me what is wrong with this script! I believe it just cannot find the image despite it being on the screen. Here is the code that for some reason, will not work.

Code: Select all

Label>bbah
//Find and Left Click Center of 
FindImagePos>%BMP_DIR%\image_1.bmp,WINDOW:Growtopia,0,1,XArr,YArr,habb,EXACT
If>habb>0
Wait>.75
  MouseMove>XArr_0,YArr_0
  LDown
  Wait>.15
  LUp
Endif
If>habb=0
Goto>bbah
Endif
That obviously isn't the whole script, but I made sure I don't have any "Num Found Var" the same on other image finding commands. So basically making it search until it finds the image. I did this instead of "WaitScreenImage" in this particular case because I wanted the script to once it found the image on the screen place the cursor on the image. I tried adding in wait time just to see if anything would be fixed, to no avail. The mouse literally just sits on my screen flashing whilst the image is on the screen like it's still waiting for the image to appear

User avatar
Marcus Tettmar
Site Admin
Posts: 7378
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Image searching issues

Post by Marcus Tettmar » Tue May 26, 2020 10:02 am

You have a tolerance of zero. No tolerance. I'd set it about 0.5 to 0.7 for Exact.

But if WaitScreenImage works for you then why not use it. Don't really follow that you can't use it because you want to put the mouse on the found image afterwards. Just do that:

Example from the manual:

Code: Select all

WaitScreenImage>%SCRIPT_DIR%\save.bmp,0.7,CCOEFF,XArr,YArr
MouseMove>XArr_0,YArr_0
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

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