Jump to content

help - condition count 3 reset on false loop


Recommended Posts

I am trying to figure best way to code a loop that after 3 positives it will proceed. On any negativity the code will reset and loop.

 

Do
    $endofstage = PixelSearch( 484, 225, 551, 280, $bluexp, 5)
    Sleep (Random (600, 800))
    If IsArray ($endofstage) = 1 Then
        Local $e = $e + 1
    Else
        Local $e = 0
    EndIf
Until $e > 3

Mouse click...

 

The goal i to pixel search an area 3 times over a period and if blue in all cases proceed. If not reset to zero and repeat until conditions are met. Ideas or input would be appreciated.

Link to post
Share on other sites

lol you'll might get burned pretty hard for posting something that reads a bit like game automation though 

Do
    $endofstage = PixelSearch( 484, 225, 551, 280, $bluexp, 5)
    Sleep (Random (600, 800))
    If IsArray ($endofstage) = 1 Then
        Local $e = $e + 1
        if $e = 3 then ExitLoop
    Else
        Local $e = 0
    EndIf
Until $e > 3

 

Link to post
Share on other sites

I am operating a computer that runs directional drilling software that has a number of extremely simple tasks that are trigger based.

This type of system would work on all our computer configurations without being intrusive or problematic to others.

instead of accessing the database which changes constantly and is locked  I am making color based que and need to help eliminate false positives due to detecting pumps down or data lag. Thus have it detect the color 3 times over a period of time 

I did not think it was a big deal but guess I'll keep working on it  thanks for the help.

 

 

Link to post
Share on other sites
Local $e=0
Do
    $endofstage = PixelSearch( 484, 225, 551, 280, $bluexp, 5)
    Sleep (Random (600, 800))
    If IsArray ($endofstage) = 1 Then
        $e += 1
    Else
        $e = 0
    EndIf
Until $e > 3

Declare variables once, and always outside of loops.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...