multiple images Error

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
KiKAS
Newbie
Posts: 7
Joined: Sat Dec 07, 2019 10:41 am

multiple images Error

Post by KiKAS » Fri Jun 26, 2020 8:58 pm

Need Help With this i have this code and it works fine but only if it find image on screen if it didnt find any image it give me error: Line9 invalid numeric value for mousemove command, i commented line 9 in the code below i guess the problem is in the XArr,YArr cause it have the same name as image before it, i tryed to rename it like i did in NumFound and NumFound1 but no luck how can i fix that?

SetFocus>Screen One
Srt>Bases
FindImagePos>C:\Users\KiKAS\Desktop\pics for last shelter\Adcanced\LvL 25 base.bmp,SCREEN,0.7,1,XArr,YArr,NumFound,CCOEFF
FindImagePos>C:\Users\KiKAS\Desktop\pics for last shelter\Adcanced\Purple Base.bmp,SCREEN,0.7,1,XArr,YArr,NumFound1,CCOEFF
If>NumFound>0
MouseMove>XArr_0,YArr_0
LClick
Else>NumFound1>0
MouseMove>XArr_0,YArr_0 //this is line 9
LClick
EndIF
END>Bases

GoSub>Bases

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

Re: multiple images Error

Post by Dorian (MJT support) » Sat Jun 27, 2020 5:40 pm

My guess is you're trying to do something like this.. Note how I use "Else" differently..

//If lvl25 base is found, click on it, if not, click on purple.

Code: Select all

SetFocus>Screen One
Srt>Bases
FindImagePos>C:\Users\KiKAS\Desktop\pics for last shelter\Adcanced\LvL 25 base.bmp,SCREEN,0.7,1,XArr,YArr,NumFound,CCOEFF
FindImagePos>C:\Users\KiKAS\Desktop\pics for last shelter\Adcanced\Purple Base.bmp,SCREEN,0.7,1,XXArr,YYArr,NumFound1,CCOEFF

If>NumFound>0
MouseMove>XArr_0,YArr_0
LClick
Else
MouseMove>XXArr_0,YYArr_0
LClick
EndIF
END>Bases

GoSub>Bases

//If lvl25 base is found, click on it, if purple is found, click on it.

Code: Select all

SetFocus>Screen One
Srt>Bases
FindImagePos>C:\Users\KiKAS\Desktop\pics for last shelter\Adcanced\LvL 25 base.bmp,SCREEN,0.7,1,XArr,YArr,NumFound,CCOEFF
FindImagePos>C:\Users\KiKAS\Desktop\pics for last shelter\Adcanced\Purple Base.bmp,SCREEN,0.7,1,XXArr,YYArr,NumFound1,CCOEFF

If>NumFound>0
MouseMove>XArr_0,YArr_0
LClick
EndIF

If>NumFound1>0
MouseMove>XXArr_0,YYArr_0
LClick
EndIF
END>Bases

GoSub>Bases


Usage for If/Else/Endif is :

Code: Select all

If>this=that
...do something
else
...do something else
Endif
Yes, we have a Custom Scripting Service. Message me or go here

KiKAS
Newbie
Posts: 7
Joined: Sat Dec 07, 2019 10:41 am

Re: multiple images Error

Post by KiKAS » Sat Jun 27, 2020 6:01 pm

Thank you dorian for your help

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

Re: multiple images Error

Post by Dorian (MJT support) » Sun Jun 28, 2020 5:49 pm

Always happy to help.
Yes, we have a Custom Scripting Service. Message me or go here

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