Jump to content

Having problem with script.


Recommended Posts

$bugcheck = 0

While 1

$mdone = PixelSearch (8, 752, 31, 768, 0xFFE345, 10 )

If UBound($mdone)>1 Then

$pausetime = 3

$pausename = " Waiting "

PauseTime()

ToolTip("")

ExitLoop

Else

While 1

$mdone = PixelSearch (8, 752, 31, 768, 0xFFE345, 10 )

If UBound($mdone)>1 Then

$pausetime = 3

$pausename = " Waiting "

PauseTime()

ToolTip("")

ExitLoop

Else

$bugcheck +=1

If $bugcheck >=6 Then

ToolTip(" became bugged ", 400, 3)

Sleep(100)

Alarm1()

$pausetime = 23

$pausename = " Waiting longer "&$bugcheck

PauseTime()

ToolTip("")

MouseClick("right", 115, 105 ) ; clicking again

Sleep(500)

MouseClick("left", 154, 145 ) ;

Sleep(500)

EndIf

EndIf

WEnd

EndIf

WEnd

$bugcheck = 0

What the script is supposed to do is play the last part of the script, where it waits 23 seconds, up to 6 times, if it's stuck in this loop 6 times over then bugcheck becomes greater than 6 and function alarm1 begins. If the script doesn't get stuck in the loop it's supposed to set bugcheck back to 0.

From what i've seen the script does everything the way I want it to, except even when it doesn't get stuck in the loop the alarm function is activated anyway? What am I doing wrong?

Link to comment
Share on other sites

Popeye1, you have been around long enough to know that no-one wants to struggle reading your code in order to help you.

You are going to get help a lot sooner if you use

[autoít]

Your code here

[/autoít]

To result in this

$bugcheck = 0
While 1
    $mdone = PixelSearch(8, 752, 31, 768, 0xFFE345, 10)
    If UBound($mdone) > 1 Then
        $pausetime = 3
        $pausename = " Waiting "
        PauseTime()
        ToolTip("")
        ExitLoop
    Else
        While 1
            $mdone = PixelSearch(8, 752, 31, 768, 0xFFE345, 10)
            If UBound($mdone) > 1 Then
                $pausetime = 3
                $pausename = " Waiting "
                PauseTime()
                ToolTip("")
                ExitLoop
            Else
                $bugcheck += 1
                If $bugcheck >= 6 Then
                    ToolTip(" became bugged ", 400, 3)
                    Sleep(100)
                    Alarm1()
                    $pausetime = 23
                    $pausename = " Waiting longer " & $bugcheck
                    PauseTime()
                    ToolTip("")
                    MouseClick("right", 115, 105) ; clicking again
                    Sleep(500)
                    MouseClick("left", 154, 145) ;
                    Sleep(500)
                EndIf
            EndIf
        WEnd
    EndIf
WEnd
$bugcheck = 0

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Try this

$bugcheck = 0
While 1
    $mdone = PixelSearch(8, 752, 31, 768, 0xFFE345, 10)
    If UBound($mdone) > 1 Then
        $pausetime = 3
        $pausename = " Waiting "
        PauseTime()
        ToolTip("")
        ExitLoop
    Else
        While 1
            $mdone = PixelSearch(8, 752, 31, 768, 0xFFE345, 10)
            If UBound($mdone) > 1 Then
                $pausetime = 3
                $pausename = " Waiting "
                PauseTime()
                ToolTip("")
                ExitLoop
            Else
                $bugcheck += 1
                If $bugcheck >= 6 Then
                    ToolTip(" became bugged ", 400, 3)
                    Sleep(100)
                    Alarm1()
                    $pausetime = 23
                    $pausename = " Waiting longer " & $bugcheck
                    PauseTime()
                    ToolTip("")
                    MouseClick("right", 115, 105) ; clicking again
                    Sleep(500)
                    MouseClick("left", 154, 145) ;
                    Sleep(500)
                EndIf
            EndIf
        WEnd
        $bugcheck = 0
    EndIf
WEnd
Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

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