FIP tolerance problem.

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Ch0ch1ik
Newbie
Posts: 5
Joined: Tue Aug 09, 2016 12:19 pm

FIP tolerance problem.

Post by Ch0ch1ik » Wed Aug 10, 2016 9:06 am

Hi every1,

I'm trying to make working bot for android game (auto click bot on mobizen app).
Idea is pretty simple: start battle->check reward->if reward is good - keep it, if it s*cks - sell it for resources->repeat.
Everything is working perfect using exact match except part of checking reward - if i set exact match - macro can't find image on screen, if i set CCOEFF with any value below 1, f.g. 0.7-0.99 - macro click weird part of screen.
I attached example of image i need to find, part of it that defines is it good or not and what coordinate macro found it on screen.
Any help would be appreaciated - rest of images, f.g. start battle/ok/reward, etc. works good with exact match.
All images was captured using Image Capture Tool. Images are found on full screen mobizen window.
Whole script below:

Code: Select all

Label>WaitForAnImage
//Find and Left Click Center of
FindImagePos>%BMP_DIR%\start.bmp,SCREEN,0,1,XArr,YArr,NumFound,EXACT
If>NumFound>0
  MouseMove>XArr_0,YArr_0
  LClick
  Let>FoundAnImage=TRUE
Endif
wait>0.1
//Find and Left Click Center of
FindImagePos>%BMP_DIR%\reward.bmp,SCREEN,0,1,XArr,YArr,NumFound,EXACT
If>NumFound>0
  MouseMove>XArr_0,YArr_0
  LClick
  wait>2
  Lclick
  Let>FoundAnImage=TRUE
Endif

wait>0.1
//Find FIRST image
FindImagePos>%BMP_DIR%\4starlegendary.bmp,SCREEN,0,1,XArr,YArr,a1,EXACT
If>a1>0
  FindImagePos>%BMP_DIR%\sell.bmp,SCREEN,0,1,XArr,YArr,b1,EXACT
If>b1>0
  MouseMove>XArr_0,YArr_0
  LClick
  Let>FoundAnImage=TRUE
Endif
  Endif

wait>0.1
//Find FIRST image
FindImagePos>%BMP_DIR%\4starpurple.bmp,SCREEN,0,1,XArr,YArr,a2,EXACT
If>a2>0
  FindImagePos>%BMP_DIR%\sell.bmp,SCREEN,0.7,1,XArr,YArr,b2,CCOEFF
If>b2>0
  MouseMove>XArr_0,YArr_0
  LClick
  Let>FoundAnImage=TRUE
Endif
  Endif

wait>0.1
//Find FIRST image
FindImagePos>%BMP_DIR%\4starblue.bmp,SCREEN,0,1,XArr,YArr,a3,EXACT
If>a3>0
MouseMove>XArr_0,YArr_0
FindImagePos>%BMP_DIR%\sell.bmp,SCREEN,0.7,1,XArr,YArr,b3,CCOEFF
If>b3>0
  MouseMove>XArr_0,YArr_0
  LClick
  Let>FoundAnImage=TRUE
Endif
  Endif

wait>0.1
//Find FIRST image
FindImagePos>%BMP_DIR%\5starblue.bmp,SCREEN,0,1,XArr,YArr,a4,EXACT
If>a4>0
  FindImagePos>%BMP_DIR%\sell.bmp,SCREEN,0.7,1,XArr,YArr,b4,CCOEFF
If>b4>0
  MouseMove>XArr_0,YArr_0
  LClick
  Let>FoundAnImage=TRUE
Endif
  Endif

wait>0.1
//Find FIRST image
FindImagePos>%BMP_DIR%\5starpurple.bmp,SCREEN,0,1,XArr,YArr,a5,EXACT
If>a5>0
//If FIRST image found, get position of image TWO and click on THAT
   FindImagePos>%BMP_DIR%\sell.bmp,SCREEN,0.7,1,XArr,YArr,b5,CCOEFF
If>b5>0
  MouseMove>XArr_0,YArr_0
  LClick
  Let>FoundAnImage=TRUE
Endif
  Endif

wait>0.1
//Find FIRST image
FindImagePos>%BMP_DIR%\5starlegendary.bmp,SCREEN,0,1,XArr,YArr,a6,EXACT
If>a6>0
  //If FIRST image found, get position of image TWO and click on THAT
  FindImagePos>%BMP_DIR%\get.bmp,SCREEN,0.7,1,XArr,YArr,b6,EXACT
  If>b6>0
    MouseMove>XArr_0,YArr_0
    LClick
    Let>FoundAnImage=TRUE
  Endif
Endif
wait>0.1
//Find FIRST image
FindImagePos>%BMP_DIR%\6starlegendary.bmp,SCREEN,0,1,XArr,YArr,a7,EXACT
If>a7>0
  //If FIRST image found, get position of image TWO and click on THAT
  FindImagePos>%BMP_DIR%\get.bmp,SCREEN,0,1,XArr,YArr,b7,EXACT
  If>b7>0
    MouseMove>XArr_0,YArr_0
    LClick
    Let>FoundAnImage=TRUE
  Endif
Endif
wait>0.1
//Find FIRST image
FindImagePos>%BMP_DIR%\6starpurple.bmp,SCREEN,0,1,XArr,YArr,a8,EXACT
If>a8>0
  //If FIRST image found, get position of image TWO and click on THAT
  FindImagePos>%BMP_DIR%\get.bmp,SCREEN,0,1,XArr,YArr,b8,EXACT
  If>b8>0
    MouseMove>XArr_0,YArr_0
    LClick
    Let>FoundAnImage=TRUE
  Endif
Endif
wait>0.1
//Find FIRST image
FindImagePos>%BMP_DIR%\6starblue.bmp,SCREEN,0.7,1,XArr,YArr,a9,CCOEFF
If>a9>0
  //If FIRST image found, get position of image TWO and click on THAT
  FindImagePos>%BMP_DIR%\get.bmp,SCREEN,0,1,XArr,YArr,b9,EXACT
  If>b9>0
    MouseMove>XArr_0,YArr_0
    LClick
    Let>FoundAnImage=TRUE
  Endif
Endif
wait>0.1
//Find and Left Click Center of
FindImagePos>%BMP_DIR%\yes.bmp,SCREEN,0,1,XArr,YArr,NumFound,EXACT
If>NumFound>0
  MouseMove>XArr_0,YArr_0
  LClick
  Let>FoundAnImage=TRUE
Endif
wait>0.1
//Find FIRST image
FindImagePos>%BMP_DIR%\unknown scroll.bmp,SCREEN,0,1,XArr,YArr,NumFound2,EXACT
If>NumFound2>0
  //If FIRST image found, get position of image TWO and click on THAT
  FindImagePos>%BMP_DIR%\ok.bmp,SCREEN,0,1,XArr,YArr,NumFound3,EXACT
  If>NumFound3>0
    MouseMove>XArr_0,YArr_0
    LClick
    Let>FoundAnImage=TRUE
  Endif
Endif
wait>0.1
//Find FIRST image
FindImagePos>%BMP_DIR%\mystical scroll.bmp,SCREEN,0,1,XArr,YArr,NumFound2a,EXACT
If>NumFound2a>0
  //If FIRST image found, get position of image TWO and click on THAT
  FindImagePos>%BMP_DIR%\ok.bmp,SCREEN,0,1,XArr,YArr,NumFound3a,EXACT
  If>NumFound3a>0
    MouseMove>XArr_0,YArr_0
    LClick
    Let>FoundAnImage=TRUE
  Endif
Endif
wait>0.1
//Find FIRST image
FindImagePos>%BMP_DIR%\rainbowmon.bmp,SCREEN,0,1,XArr,YArr,NumFound4,EXACT
If>NumFound4>0
  //If FIRST image found, get position of image TWO and click on THAT
  FindImagePos>%BMP_DIR%\ok.bmp,SCREEN,0.7,1,XArr,YArr,NumFound5,EXACT
  If>NumFound5>0
    MouseMove>XArr_0,YArr_0
    LClick
    Let>FoundAnImage=TRUE
  Endif
Endif
wait>0.1
//Find FIRST image
FindImagePos>%BMP_DIR%\shapeshiftstone.bmp,SCREEN,0,1,XArr,YArr,NumFound6,EXACT
If>NumFound6>0
  //If FIRST image found, get position of image TWO and click on THAT
  FindImagePos>%BMP_DIR%\ok.bmp,SCREEN,0,1,XArr,YArr,NumFound7,EXACT
  If>NumFound7>0
    MouseMove>XArr_0,YArr_0
    LClick
    Let>FoundAnImage=TRUE
  Endif
Endif
wait>0.1
//Find FIRST image
FindImagePos>%BMP_DIR%\summoning stone.bmp,SCREEN,0,1,XArr,YArr,NumFound8,EXACT
If>NumFound8>0
  //If FIRST image found, get position of image TWO and click on THAT
  FindImagePos>%BMP_DIR%\ok.bmp,SCREEN,0,1,XArr,YArr,NumFound9,EXACT
  If>NumFound9>0
    MouseMove>XArr_0,YArr_0
    LClick
    Let>FoundAnImage=TRUE
  Endif
Endif
wait>0.1
//Find and Left Click Center of
FindImagePos>%BMP_DIR%\replay.bmp,SCREEN,0,1,XArr,YArr,NumFound10,EXACT
If>NumFound10>0
  MouseMove>XArr_0,YArr_0
  LClick
  Let>FoundAnImage=TRUE
Endif
wait>0.1

//Find and Left Click Center of
FindImagePos>%BMP_DIR%\image_1.bmp,SCREEN,0,1,XArr,YArr,NumFound11,EXACT
If>NumFound11>0
  MouseMove>XArr_0,YArr_0
  LClick
Endif
wait>0.1
//Find and Do Nothing Center of
FindImagePos>%BMP_DIR%\image_2.bmp,SCREEN,0,1,XArr,YArr,NumFound12,EXACT
If>NumFound12>0
MouseMove>XArr_0,YArr_0
LClick
wait>3
//Find and Left Click Center of
FindImagePos>%BMP_DIR%\image_3.bmp,SCREEN,0,1,XArr,YArr,NumFound13,EXACT
If>NumFound13>0
  MouseMove>XArr_0,YArr_0
  LClick
  wait>2
//Find and Left Click Center of
FindImagePos>%BMP_DIR%\image_4.bmp,SCREEN,0,1,XArr,YArr,NumFound14,EXACT
If>NumFound14>0
  MouseMove>XArr_0,YArr_0
  LClick
  Let>FoundAnImage=TRUE
Endif

endif

Endif





If>FoundAnImage=FALSE
  //Neither image was found, loop back and look again
  Wait>0.2
  Goto>WaitForAnImage
Endif
Label>WaitForAnImage
  // do something here
Goto>WaitForAnImage




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

Re: FIP tolerance problem.

Post by Marcus Tettmar » Mon Aug 15, 2016 2:41 pm

Maybe graduated/uneven background affecting image comparison ?

Maybe this will help:

https://www.mjtnet.com/blog/2009/02/13/ ... -mistakes/
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

Ch0ch1ik
Newbie
Posts: 5
Joined: Tue Aug 09, 2016 12:19 pm

Re: FIP tolerance problem.

Post by Ch0ch1ik » Tue Aug 16, 2016 7:47 am

Marcus Tettmar wrote:Maybe graduated/uneven background affecting image comparison ?

Maybe this will help:

https://www.mjtnet.com/blog/2009/02/13/ ... -mistakes/
It affects image capture for sure, i guess that's why it can't find image using exact match, but i don't get why while using 0.7 tolerance macro finds image on grey settings bar :( .


So far i've noticed that image recognition works perfectly with newer phone. It seems like lower resolution of older phone causes the problem, is it possible? I imagine this like older phone displays same image using fg. 10 pixels, while newer fg. 80 pixels and using 10 pixels image, macro has just fg. 4 white pixels and 6 grayscale + tolerance and it finds all gray pixels on the screen. May my way of thinking be correct? If yes, any ideas how to make it work on older phone?

Ch0ch1ik
Newbie
Posts: 5
Joined: Tue Aug 09, 2016 12:19 pm

Re: FIP tolerance problem.

Post by Ch0ch1ik » Thu Sep 01, 2016 6:34 am

Hi,

It looks like i figured out what was the problem - windows 10 compability.
When macro do random click i need to restart pc or simply kill msched.exe process.
If any1 have similar problem u can try this.

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

Re: FIP tolerance problem.

Post by Marcus Tettmar » Thu Sep 01, 2016 7:51 am

Can you expand on what you mean by Windows 10 compatibility problems? Do you mean the app you are automating? Sending mouse clicks in Windows 10 is perfectly well supported. We are using image recognition to click on objects in Windows 10 all the time.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

Ch0ch1ik
Newbie
Posts: 5
Joined: Tue Aug 09, 2016 12:19 pm

Re: FIP tolerance problem.

Post by Ch0ch1ik » Fri Sep 02, 2016 12:06 pm

I'm not sure what couse the problem, maybe it's not just windows 10 but my laptop itself, i've just noticed it works perfect on different machine with different windows, but i don't have another machine with windows 10 to do more tests. And btw my trial copy expired so i can't check other options.

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