Hi, you need to think through which images you are looking for and when, eg
If image1 comes then it must be followed by image2 (eg continue) or image3 (eg cancel)
If image4 comes then it must be followed by image5 (eg next) or image6 (eg cancel)
It's like you have different states where you look for different things and you can only move between the states in a certain order.
I created a little example for how you can use onEvent>.
In this simple case it looks for an image and when it finds it, clicks on it and moves to the next state and looks for another image, clicks on it until there has been 1 second since the last image found. (So if the same image shows up 20 times then it will click 20 times). After that it returns to the original state and continues looking for the original image again, and so on.
You need to adjust it for your situation but hopefully it illustrates the logic. Define the states and what to look for / action to take, and what state you want to move to next. You can easily add more onEvents, states and SRTs. Only the imagination limits what can be created.
Hope it helps.
Code: Select all
//Define array for States (1/0) active or not
ArrayDim>State,2
//Update States - Activate State 1
CODEBLOCK
Let>State_1=1
Let>State_2=0
ENDCODEBLOCK
//Define Events
CODEBLOCK
OnEvent>CUSTOM,MyTriggerSub1,DoIT1,DoSomething1
OnEvent>CUSTOM,MyTriggerSub2,DoIT2,DoSomething2
ENDCODEBLOCK
Label>Main
Wait>0.1
Goto>Main
//SRT for Event 1
SRT>MyTriggerSub1
If>State_1=1
FindImagePos>%BMP_DIR%\......,SCREEN,0.7,1,XArr1,YArr1,NumFound1,CCOEFF
If>NumFound1>0
Timer>time0
Let>DoIT1=TRUE
Endif
Endif
END>MyTriggerSub1
SRT>DoSomething1
MouseMove>XArr1_0,YArr1_0
LClick>
Wait>0.2
//Update States - Activate State 2
CODEBLOCK
Let>State_1=0
Let>State_2=1
ENDCODEBLOCK
Let>DoIT1=FALSE
END>DoSomething1
//SRT for Event 2
SRT>MyTriggerSub2
If>State_2=1
FindImagePos>%BMP_DIR%\....,0.7,1,XArr2,YArr2,NumFound2,CCOEFF
If>NumFound2>0
Timer>time0
Let>DoIT2=TRUE
Else
Timer>time1
Let>TimeDiff={%time1%-%time0%}
//Check if 1 sec has passed since last image found
If>TimeDiff>1000
//Update States - Activate State 1
CODEBLOCK
Let>State_1=1
Let>State_2=0
ENDCODEBLOCK
Let>DoIT2=FALSE
Endif
Endif
Endif
END>MyTriggerSub2
SRT>DoSomething2
MouseMove>XArr2_0,YArr2_0
LClick>
Wait>0.2
END>DoSomething2