Jump to content

Recommended Posts

Posted

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.

Posted

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.

 

 

Posted

It runs for a while then errors out.

local $e = $e + 1

local $e = ^ error

Can not initialize a variable with itself. 

 

I have ave a feeling using this method is not very efficient and I need to think of a better solution. 

Posted
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.

Posted

Thank you again. Feel free to close the thread.

 

Part of the issue was I decleared the veritable too often. Maybe some day I'll know enough to actually contribute. :lmao:

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...