Sleepyguy Posted October 28, 2017 Posted October 28, 2017 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.
gruntydatsun Posted October 29, 2017 Posted October 29, 2017 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 Sleepyguy 1
Sleepyguy Posted October 29, 2017 Author Posted October 29, 2017 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.
Sleepyguy Posted October 29, 2017 Author Posted October 29, 2017 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.
RTFC Posted October 29, 2017 Posted October 29, 2017 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. Sleepyguy 1 My Contributions and Wrappers Spoiler BitMaskSudokuSolver BuildPartitionTable CodeCrypter CodeScanner DigitalDisplay Eigen4AutoIt FAT Suite HighMem MetaCodeFileLibrary OSgrid Pool RdRand SecondDesktop SimulatedAnnealing Xbase I/O
Sleepyguy Posted October 29, 2017 Author Posted October 29, 2017 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now