Jump to content

Getting error and don know what is happening


Recommended Posts

I get error when running this script

Opt("PixelCoordMode", 2)
Opt("MouseCoordMode", 2)


HotKeySet("^z", "_Pause")
HotKeySet("^x", "_exit")

Global $Paused
Func _Pause()
    $Paused = Not $Paused
    While $Paused
        Sleep(100)
        ToolTip("GzAuto Stopped...", 800, 0)
    WEnd
EndFunc  ;==>_Pause

Func _exit()
    Exit
EndFunc  ;==>_exit
$colour = 0x73AE9C


$sleep = InputBox("Please Enter", "The Time Needed To Kill 1 Monster(Second)", "", " M4", 250, 100)
If @error = 1 Then Exit

WinWaitActive("Tester")

While 1
    ToolTip("GzAuto Running...", 800, 0)
    For $search = 150 To 800 Step 30
        $click = 0
        Sleep(100)
        $jp = PixelSearch(0, 0, 900, 900, 0x73AE9C)
        $point = PixelGetColor($jp[0], $jp[1])
        MouseClick("", $jp[0], $jp[1], 1, 0)
        MouseMove(0, 0, 0)
        Sleep($sleep * 1000)
        ExitLoop
        
    Next
    For $search = 150 To 800 Step 30
        $click = 0
        Sleep(100)
        $jp = PixelSearch(0, 0, 900, 900, 0xffe7ad)
        $point = PixelGetColor($jp[0], $jp[1])
        MouseClick("", $jp[0], $jp[1], 1, 0)
        MouseMove(0, 0, 0)
        Sleep($sleep * 1000)
        ExitLoop
        
    Next
WEnd

All i want is to change colour after the first one have been done.... anyhelp?

Link to comment
Share on other sites

Since I have no clue what you mean by "after the first one is done"...

Also the variable $colour is declared but you never actually use it in your script...

Opt("PixelCoordMode", 2)
Opt("MouseCoordMode", 2)


HotKeySet("^z", "_Pause")
HotKeySet("^x", "_exit")

Global $Paused

$colour = 0x73AE9C

$sleep = InputBox("Please Enter", "The Time Needed To Kill 1 Monster(Second)", "", " M4", 250, 100)
If @error = 1 Then Exit

WinWaitActive("Tester")

While 1
    ToolTip("GzAuto Running...", 800, 0)
    For $search = 150 To 800 Step 30
        $click = 0
        Sleep(100)
        $jp = PixelSearch(0, 0, 900, 900, 0x73AE9C)
        $point = PixelGetColor($jp[0], $jp[1])
        MouseClick("", $jp[0], $jp[1], 1, 0)
        MouseMove(0, 0, 0)
        Sleep($sleep * 1000)
        ExitLoop

    Next
    For $search = 150 To 800 Step 30
        $click = 0
        Sleep(100)
        $jp = PixelSearch(0, 0, 900, 900, 0xffe7ad)
        $point = PixelGetColor($jp[0], $jp[1])
        MouseClick("", $jp[0], $jp[1], 1, 0)
        MouseMove(0, 0, 0)
        Sleep($sleep * 1000)
        ExitLoop

    Next
    
    $colour = 0x73AE9C ;????????????????????????????
WEnd

Func _Pause()
    $Paused = Not $Paused
    While $Paused
        Sleep(100)
        ToolTip("GzAuto Stopped...", 800, 0)
    WEnd
EndFunc   ;==>_Pause

Func _exit()
    Exit
EndFunc   ;==>_exit
Link to comment
Share on other sites

I'm not really sure what you are looking for. Maybe....

Opt("PixelCoordMode", 2)
Opt("MouseCoordMode", 2)


HotKeySet("^z", "_Pause")
HotKeySet("^x", "_exit")

Global $Paused

$colour1 = 0x73AE9C
$colour2 = 0xffe7ad

$sleep = InputBox("Please Enter", "The Time Needed To Kill 1 Monster(Second)", "", " M4", 250, 100)
If @error = 1 Then Exit

WinWaitActive("Tester")

While 1
    ToolTip("GzAuto Running...", 800, 0)
    For $search = 150 To 800 Step 30
        $click = 0
        Sleep(100)
        $jp = PixelSearch(0, 0, 900, 900, $colour1)
        $point = PixelGetColor($jp[0], $jp[1])
        MouseClick("", $jp[0], $jp[1], 1, 0)
        MouseMove(0, 0, 0)
        Sleep($sleep * 1000)
        ExitLoop

    Next
    For $search = 150 To 800 Step 30
        $click = 0
        Sleep(100)
        $jp = PixelSearch(0, 0, 900, 900, $colour2)
        $point = PixelGetColor($jp[0], $jp[1])
        MouseClick("", $jp[0], $jp[1], 1, 0)
        MouseMove(0, 0, 0)
        Sleep($sleep * 1000)
        ExitLoop

    Next

WEnd

Func _Pause()
    $Paused = Not $Paused
    While $Paused
        Sleep(100)
        ToolTip("GzAuto Stopped...", 800, 0)
    WEnd
EndFunc   ;==>_Pause

Func _exit()
    Exit
EndFunc   ;==>_exit
Edited by weaponx
Link to comment
Share on other sites

Thats because you are doing a presumptious pixel search.

$jp = PixelSearch(0, 0, 900, 900, $colour1)

$point = PixelGetColor($jp[0], $jp[1])

MouseClick("", $jp[0], $jp[1], 1, 0)

You have no error checking after the pixelsearch like IsArray($jp)

Also you are searching for a pixel with a KNOWN color and then running a PixelGetColor() on that same exact pixel even though you already know the color. Its bass-ackwards.

Edited by weaponx
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...