Jump to content

PixelSearch Script


Recommended Posts

OK here is what I have it runs fine and loops 6 times I want the loops to stop if the Pixelsearch detects no pixels here is what please excuse it I am still learning and my code is ugly.

While 1 = 1

Sleep(5000)

Send("{ESCAPE}")

Sleep(500)

Send("{ESCAPE}")

Sleep(500)

Send("{ESCAPE}")

Sleep(500)

Send("{ESCAPE}")

Sleep(500)

Send("{CTRLDOWN}")

Sleep(1000)

Send("{4}")

Sleep(500)

Send("{CTRLUP}")

Sleep(1000)

Send("{ENTER}")

Sleep(2000)

Send("{ENTER}")

Sleep(2000)

Send("{DOWN}")

Sleep(1000)

Send("{ENTER}")

Sleep(2000)

Send("{ENTER}")

Sleep(2000)

Send("{ENTER}")

Sleep(7000)

$coor = PixelSearch(32, 40, 373, 147, 0x841F29, 2, 2)

If @error Then ContinueLoop

For $x = 0 To 6

Sleep(2000)

Send("{CTRLDOWN}")

Sleep(1000)

Send("{1}")

Sleep(1000)

Send("{CTRLUP}")

Sleep(38000)

Next

Send("{ESCAPE}")

Sleep(500)

Send("{ESCAPE}")

Sleep(500)

Send("{ESCAPE}")

Sleep(500)

Send("{ESCAPE}")

Sleep(500)

Send("{CTRLDOWN}")

Sleep(1000)

Send("{4}")

Sleep(1000)

Send("{CTRLUP}")

Sleep(1000)

Send("{ENTER}")

Sleep(2000)

Send("{ENTER}")

Sleep(2000)

Send("{DOWN}")

Sleep(2000)

Send("{ENTER}")

Sleep(2000)

Send("{ENTER}")

Sleep(2000)

Send("{ESCAPE}")

Sleep(7000)

WEnd

What is happening is the loop continues even after the pixel goes away if the loop has already started I want it to stop if the pixel goes away on its next cycle any ideas on how to do this ?

Link to comment
Share on other sites

Not sure what your asking but....

maybe

If @error = 1 Then

Exit

endif

Where it says loopcontinue I want the loop to stop after its cycle if its started if the pixel disappears during its cycle. It checks for the pixel then begins its cycle loops 6 times if the pixel is still there. If the pixel disappears I want it to stop after the cycle it disappeared on . and continue on down like normal as if it did loop 6 times. Does that make sense?

Link to comment
Share on other sites

So you want to check if the pixel exists with this

$coor = PixelSearch(32, 40, 373, 147, 0x841F29, 2, 2)

And if the pixel does not exist, you want this to run?

If @error Then
For $x = 0 To 6
;do stuff
Next
Endif
Edited by TheDarkEngineer

Trust me to make SkyNet with AutoIt...

Link to comment
Share on other sites

So you want to check if the pixel exists with this

$coor = PixelSearch(32, 40, 373, 147, 0x841F29, 2, 2)

And if the pixel does not exist, you want this to run?

If @error Then
For $x = 0 To 6
;do stuff
Next
Endif
err sort of I want that to run if the pixels exist if they go away I want that loop to stop and shift down to

Send("{ESCAPE}")

Sleep(500)

Send("{ESCAPE}")

Sleep(500)

Send("{ESCAPE}")

Sleep(500)

Send("{ESCAPE}")

Sleep(500)

Send("{CTRLDOWN}")

Sleep(1000)

Send("{4}")

Sleep(1000)

Send("{CTRLUP}")

Sleep(1000)

Send("{ENTER}")

Sleep(2000)

Send("{ENTER}")

Sleep(2000)

Send("{DOWN}")

Sleep(2000)

Send("{ENTER}")

Sleep(2000)

Send("{ENTER}")

Sleep(2000)

Send("{ESCAPE}")

Sleep(7000)

and the script wil start over otherwise I want it to loop if the pixels are there.

Link to comment
Share on other sites

While 1

Sleep(5000)
Send("{ESCAPE}")
Sleep(500)
Send("{ESCAPE}")
Sleep(500)
Send("{ESCAPE}")
Sleep(500)
Send("{ESCAPE}")
Sleep(500)
Send("{CTRLDOWN}")
Sleep(1000)
Send("{4}")
Sleep(500)
Send("{CTRLUP}")
Sleep(1000)
Send("{ENTER}")
Sleep(2000)
Send("{ENTER}")
Sleep(2000)
Send("{DOWN}")
Sleep(1000)
Send("{ENTER}")
Sleep(2000)
Send("{ENTER}")
Sleep(2000)
Send("{ENTER}")
Sleep(7000)

Do
$coor = PixelSearch(32, 40, 373, 147, 0x841F29, 2, 2)
if Not @error then;if the pixel exists
Sleep(2000)
Send("{CTRLDOWN}")
Sleep(1000)
Send("{1}")
Sleep(1000)
Send("{CTRLUP}")
Sleep(38000)
Endif
Until @error;keep doing this untill pixel does not exist



Send("{ESCAPE}")
Sleep(500)
Send("{ESCAPE}")
Sleep(500)
Send("{ESCAPE}")
Sleep(500)
Send("{ESCAPE}")
Sleep(500)
Send("{CTRLDOWN}")
Sleep(1000)
Send("{4}")
Sleep(1000)
Send("{CTRLUP}")
Sleep(1000)
Send("{ENTER}")
Sleep(2000)
Send("{ENTER}")
Sleep(2000)
Send("{DOWN}")
Sleep(2000)
Send("{ENTER}")
Sleep(2000)
Send("{ENTER}")
Sleep(2000)
Send("{ESCAPE}")
Sleep(7000)

WEnd

Is this what you wanted?

Edited by TheDarkEngineer

Trust me to make SkyNet with AutoIt...

Link to comment
Share on other sites

While 1

Sleep(5000)
Send("{ESCAPE}")
Sleep(500)
Send("{ESCAPE}")
Sleep(500)
Send("{ESCAPE}")
Sleep(500)
Send("{ESCAPE}")
Sleep(500)
Send("{CTRLDOWN}")
Sleep(1000)
Send("{4}")
Sleep(500)
Send("{CTRLUP}")
Sleep(1000)
Send("{ENTER}")
Sleep(2000)
Send("{ENTER}")
Sleep(2000)
Send("{DOWN}")
Sleep(1000)
Send("{ENTER}")
Sleep(2000)
Send("{ENTER}")
Sleep(2000)
Send("{ENTER}")
Sleep(7000)

Do
$coor = PixelSearch(32, 40, 373, 147, 0x841F29, 2, 2)
if Not @error then;if the pixel exists
Sleep(2000)
Send("{CTRLDOWN}")
Sleep(1000)
Send("{1}")
Sleep(1000)
Send("{CTRLUP}")
Sleep(38000)
Endif
Until @error;keep doing this untill pixel does not exist



Send("{ESCAPE}")
Sleep(500)
Send("{ESCAPE}")
Sleep(500)
Send("{ESCAPE}")
Sleep(500)
Send("{ESCAPE}")
Sleep(500)
Send("{CTRLDOWN}")
Sleep(1000)
Send("{4}")
Sleep(1000)
Send("{CTRLUP}")
Sleep(1000)
Send("{ENTER}")
Sleep(2000)
Send("{ENTER}")
Sleep(2000)
Send("{DOWN}")
Sleep(2000)
Send("{ENTER}")
Sleep(2000)
Send("{ENTER}")
Sleep(2000)
Send("{ESCAPE}")
Sleep(7000)

WEnd

Is this what you wanted?

that might work let me try it

Link to comment
Share on other sites

I am thinking there needs to be an else statement in there

I need it to loop 6 times no more then I need to make the pixel disappear so here is what happens .

Sleep(5000)

Send("{ESCAPE}")

Sleep(500)

Send("{ESCAPE}")

Sleep(500)

Send("{ESCAPE}")

Sleep(500)

Send("{ESCAPE}")

Sleep(500)

Send("{CTRLDOWN}")

Sleep(1000)

Send("{4}") Activates the pixel .

Sleep(500)

Send("{CTRLUP}")

Sleep(1000)

Send("{ENTER}")

Sleep(2000)

Send("{ENTER}")

Sleep(2000)

Send("{DOWN}")

Sleep(1000)

Send("{ENTER}")

Sleep(2000)

Send("{ENTER}")

Sleep(2000)

Send("{ENTER}")

Sleep(7000)

$coor = PixelSearch(32, 40, 373, 147, 0x841F29, 2, 2) Sees the pixel starts the loop

If @error Then ContinueLoop

For $x = 0 To 6 loops it six times

Now sometimes the pixel will disappear on its on while the loop is running if this happens i want the loop to end.

If it doesnt disappear on its own I want the loop to continue six times and then do this which now turns off the pixel if it hasnt disappeared.

Send("{ESCAPE}")

Sleep(500)

Send("{ESCAPE}")

Sleep(500)

Send("{ESCAPE}")

Sleep(500)

Send("{ESCAPE}")

Sleep(500)

Send("{CTRLDOWN}")

Sleep(1000)

Send("{4}") Deactivates the pixel if active

Sleep(500)

Send("{CTRLUP}")

Sleep(1000)

Send("{ENTER}")

Sleep(2000)

Send("{ENTER}")

Sleep(2000)

Send("{DOWN}")

Sleep(1000)

Send("{ENTER}")

Sleep(2000)

Send("{ENTER}")

Sleep(2000)

Send("{ENTER}")

Sleep(7000)

If it did somehow disappear on its on i need it to finish the cycle its on and imediately skip the loop and go to what is written above.

Link to comment
Share on other sites

While 1

Sleep(5000)
Send("{ESCAPE}")
Sleep(500)
Send("{ESCAPE}")
Sleep(500)
Send("{ESCAPE}")
Sleep(500)
Send("{ESCAPE}")
Sleep(500)

Send("^4");This sends Control 4

;Send("{CTRLDOWN}")
;Sleep(1000)
;Send("{4}")
;Sleep(500)
;Send("{CTRLUP}")

Sleep(1000)
Send("{ENTER}")
Sleep(2000)
Send("{ENTER}")
Sleep(2000)
Send("{DOWN}")
Sleep(1000)
Send("{ENTER}")
Sleep(2000)
Send("{ENTER}")
Sleep(2000)
Send("{ENTER}")
Sleep(7000)

$i=1
Do
$coor = PixelSearch(32, 40, 373, 147, 0x841F29, 2, 2)
if Not @error then;if the pixel exists
Sleep(2000)

Send("^1");sends Control 1

;Send("{CTRLDOWN}")
;Sleep(1000)
;Send("{1}")
;Sleep(1000)
;Send("{CTRLUP}")

Sleep(38000)
$i+=1
Endif
Until @error Or $i>6;keep doing this untill pixel does not exist or $i>6



Send("{ESCAPE}")
Sleep(500)
Send("{ESCAPE}")
Sleep(500)
Send("{ESCAPE}")
Sleep(500)
Send("{ESCAPE}")
Sleep(500)

Send("^4");This sends Control 4

;Send("{CTRLDOWN}")
;Sleep(1000)
;Send("{4}")
;Sleep(500)
;Send("{CTRLUP}")

Sleep(1000)
Send("{ENTER}")
Sleep(2000)
Send("{ENTER}")
Sleep(2000)
Send("{DOWN}")
Sleep(2000)
Send("{ENTER}")
Sleep(2000)
Send("{ENTER}")
Sleep(2000)
Send("{ESCAPE}")
Sleep(7000)

WEnd

Try this one.

Edited by TheDarkEngineer

Trust me to make SkyNet with AutoIt...

Link to comment
Share on other sites

While 1

Sleep(5000)
Send("{ESCAPE}")
Sleep(500)
Send("{ESCAPE}")
Sleep(500)
Send("{ESCAPE}")
Sleep(500)
Send("{ESCAPE}")
Sleep(500)

Send("^4");This sends Control 4

;Send("{CTRLDOWN}")
;Sleep(1000)
;Send("{4}")
;Sleep(500)
;Send("{CTRLUP}")

Sleep(1000)
Send("{ENTER}")
Sleep(2000)
Send("{ENTER}")
Sleep(2000)
Send("{DOWN}")
Sleep(1000)
Send("{ENTER}")
Sleep(2000)
Send("{ENTER}")
Sleep(2000)
Send("{ENTER}")
Sleep(7000)

$i=1
Do
$coor = PixelSearch(32, 40, 373, 147, 0x841F29, 2, 2)
if Not @error then;if the pixel exists
Sleep(2000)

Send("^1");sends Control 1

;Send("{CTRLDOWN}")
;Sleep(1000)
;Send("{1}")
;Sleep(1000)
;Send("{CTRLUP}")

Sleep(38000)
$i+=1
Else;this resets $i
$i=1
Endif
Until @error Or $i>6;keep doing this untill pixel does not exist or $i>6



Send("{ESCAPE}")
Sleep(500)
Send("{ESCAPE}")
Sleep(500)
Send("{ESCAPE}")
Sleep(500)
Send("{ESCAPE}")
Sleep(500)

Send("^4");This sends Control 4

;Send("{CTRLDOWN}")
;Sleep(1000)
;Send("{4}")
;Sleep(500)
;Send("{CTRLUP}")

Sleep(1000)
Send("{ENTER}")
Sleep(2000)
Send("{ENTER}")
Sleep(2000)
Send("{DOWN}")
Sleep(2000)
Send("{ENTER}")
Sleep(2000)
Send("{ENTER}")
Sleep(2000)
Send("{ESCAPE}")
Sleep(7000)

WEnd

There, I missed this bit code

Else;this resets $i
$i=1

It would have cut out of the loop too soon if it didn't reset.

Edited by TheDarkEngineer

Trust me to make SkyNet with AutoIt...

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...