If WaitScreenImage/FindImagePos, run extra lines

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Sandergutt
Newbie
Posts: 4
Joined: Fri Oct 05, 2018 8:51 pm

If WaitScreenImage/FindImagePos, run extra lines

Post by Sandergutt » Mon Oct 29, 2018 11:06 pm

This is my script and after 10-15 loops another picture appears that you need to refill energy and click some other buttons. How can I insert something else with "If picture Then code", Else jump over code and continue.
The random click code is to prevent bot-detection and works as intended. Messy but functional =)

Code: Select all

Label>FromTheStart

Let>WW_TIMEOUT=0
Let>WSI_TIMEOUT=0
CapsOff
//Activating Window: 
//SnapShotFile>%BMP_DIR%snapshot_0.png
WaitWindowOpen>BlueStacks
MoveWindow>BlueStacks,231,5
ResizeWindow>BlueStacks,543,1036
Wait>0.422

//-----------------------click button in map
Let>x=372
Let>y=833
Random>40,offset
Let>offset=offset-20
Let>x=x+offset
Let>y=y+offset
MouseMove>x,y
Wait>1.02
//Clicking on: 
//SnapShotFile>%BMP_DIR%snapshot_1.png
Wait>0.266
LClick
Wait>1.625

//------------------------click button
Let>x=513
Let>y=906
Random>40,offset
Let>offset=offset-20
Let>x=x+offset
Let>y=y+offset
MouseMove>x,y
Wait>1.551
//Clicking on: 
//SnapShotFile>%BMP_DIR%snapshot_2.png
Wait>0.281
LClick

[color=#FF0080][b]HERE I WANT OTHER CODE IF SOMETIMES PICTURE APPEARS. SO: CHECK FOR PICTURE AND RUN ADDITIONAL CODE, OR JUST CONTINUE[/b][/color]

//Wait for a picture that shows this script can continue
WaitScreenImage>%BMP_DIR%\after_other_code.PNG,0.7,CCOEFF

wait 1
//-------------------------------
Let>x=602
Let>y=828
Random>40,offset
Let>offset=offset-20
Let>x=x+offset
Let>y=y+offset
MouseMove>x,y
Wait>1.232
//Clicking on: 
//SnapShotFile>%BMP_DIR%snapshot_3.png
Wait>1.109
LClick
Wait>0.938

//-------------------------------
Let>x=653
Let>y=830
Random>40,offset
Let>offset=offset-20
Let>x=x+offset
Let>y=y+offset
MouseMove>x,y
Wait>1.393
//Clicking on: 
//SnapShotFile>%BMP_DIR%snapshot_4.png
Wait>0.313
LClick
Wait>0.859

//-------------------------------
Let>x=614
Let>y=827
Random>40,offset
Let>offset=offset-20
Let>x=x+offset
Let>y=y+offset
MouseMove>x,y
//MouseMove>614,827
Wait>0.478
//Clicking on: 
//SnapShotFile>%BMP_DIR%snapshot_5.png
Wait>0.828
LClick
Wait>4.516

Press Esc
wait 2
Goto>FromTheStart

Sandergutt
Newbie
Posts: 4
Joined: Fri Oct 05, 2018 8:51 pm

Re: If WaitScreenImage/FindImagePos, run extra lines

Post by Sandergutt » Wed Oct 31, 2018 8:15 pm

Horrible explanation, I admit.

This is what I want to do if anyone can help me out.

  • Script starts with finding a part of a picture and clicking that part.
  • Next picture pops up and i need to click a spesific part of this picture as well.
  • Then after a series of pictures that i need to click on, every 10-15 loops I get a "refill energy" popup. This is when I need to do a series of new mouse clicks that is not part of the original loop. So I want to bundle this inside a "If/Else/Endif". This is where I strugle.
  • Then script continues in the middle of the loop and there will be another 10-15 loops before next refill accurs.

User avatar
Grovkillen
Automation Wizard
Posts: 1131
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Re: If WaitScreenImage/FindImagePos, run extra lines

Post by Grovkillen » Wed Oct 31, 2018 9:50 pm

Let>ME=%Script%

Running: 15.0.27
version history

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