Jump to content

Need a little help in making my..well.. Bot..


Zigtog
 Share

Recommended Posts

Hey, I've been going at this for, well, about three days (this individual thing, I've already mastered killing, background mode, loops, ect.)

Here's what I'm having trouble with:

While $i = 2
    PixelSearch(490,190,510,240,0xFF0000, 10)
    If @error Then
        $i = 2
    ElseIf not @error Then
        $i = 3
    EndIf
WEnd

I have the first part working well and pushing it to $i = 2 from $i = 1, I used to have

While $i = 2
    PixelSearch(500,200,520,250,0xFF0000, 10)
    If @error Then
        $i = 2
        EndIf
        If not @error Then
        $i = 3
    EndIf
WEnd

then it was pointed out to me the two if's probably arn't friendly with each other, that kept pushing my script to $i = 3

also, don't mind the pixel coordinate change

I was wondering if anybody could help me make that work

In case you can't tell, its soposed to do a pixel search for, well, whats up there, and if the pixel search comes out right it goes onto $i = 3 but if it doesn't come out then it stays at $i = 2, also I'm thinking of where I can put a sleep(5000) in there, probably at the end...

Thanks in advance!

Link to comment
Share on other sites

It might just be the fact that my brain doesnt work as well as it should at 6am but surely this is your answer:

Sorry if im missing something >.<

While $i = 2
    PixelSearch(500,200,520,250,0xFF0000, 10)
    If @error Then
        $i = 2
    Else
        $i = 3
    EndIf
    ;put your sleep function here
WEnd

or you could even just get rid of the While loop all together and do:

Do
    PixelSearch(500,200,520,250,0xFF0000, 10)
    ;Add your sleep function here
Until Not @error

this will loop the pixelsearch function until the color was found.

Edited by Marlo
Click here for the best AutoIt help possible.Currently Working on: Autoit RAT
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...