Jump to content
Sleepyguy

help - condition count 3 reset on false loop

Recommended Posts

Sleepyguy

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.

Share this post


Link to post
Share on other sites
kaisies

What game is this for? 

Share this post


Link to post
Share on other sites
gruntydatsun

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

 

  • Like 1

Share this post


Link to post
Share on other sites
Sleepyguy

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.

 

 

Share this post


Link to post
Share on other sites
gruntydatsun

no worries :)  its not a big deal 

Share this post


Link to post
Share on other sites
Sleepyguy

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. 

Share this post


Link to post
Share on other sites
RTFC
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.

  • Like 1

Share this post


Link to post
Share on other sites
Sleepyguy

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:

Share this post


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

×