Jump to content
Sign in to follow this  
intelPiggy

Getting error and don know what is happening

Recommended Posts

intelPiggy

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?

Share this post


Link to post
Share on other sites
weaponx

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

Share this post


Link to post
Share on other sites
intelPiggy

Actually i was going to use $colour1 and $colour2 but i can't find a way,

mean after the script search for a colour and click

it will go to next color

then return to the first one

Share this post


Link to post
Share on other sites
weaponx

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

Share this post


Link to post
Share on other sites
intelPiggy

I used but it give me subsript error for not using array?

Share this post


Link to post
Share on other sites
weaponx

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

Share this post


Link to post
Share on other sites
intelPiggy

How to i remake the script so that it run at a "smarter" way ?

do i need to omit out the

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

??

Edited by intelPiggy

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.