Jump to content

Script exits in Do Until loop


Recommended Posts

Hey guys.

Heres my code

Do
        $MonsterFind = PixelSearch(0, 0, 800, 600, $Monsters)
        If Not @error Then
            MouseClick("right", $monsterfind[0], $Monsterfind[1])
            CheckDeath()
        EndIf
    Until @error <> 0
        Send("{W}")
        Send("{W}")

I have my bot constantly Shooting any monster which is Orange ($monsters)

and i wanted it to check to make sure its not dead.

Heres the code for that

Func CheckDeath()
$CheckerDeath = PixelGetColor(340,270)
If $CheckerDeath = $DeathPixel Then
    ProcessClose("Game.exe")
Else
    Sleep(50)
    EndIf
EndFunc  ;==>CheckDeathind

Basically it searches for a red pixel ($Death pixel) in the screen to make sure it hasnt died.

BUT!

When the script is done killing the monsters, and it is time to go to the next level (Send-W x 2) the script exits.

Why! Thanks.

Link to comment
Share on other sites

Well one problem, is Send ("{W}") is not how you send a w. (take out the curly brackets)

Actually you can send W while it's in brackets.

Do you have the first code snippet inside of a loop?

While 1
    Do
            $MonsterFind = PixelSearch(0, 0, 800, 600, $Monsters)
        If Not @error Then
            MouseClick("right", $monsterfind[0], $Monsterfind[1])
            CheckDeath()
            EndIf
    Until @error <> 0
        Send("{W}")
        Send("{W}")
Wend

Otherwise, it would just exit. That's the only thing I could see wrong.

[b][/b]

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