Jump to content
Sign in to follow this  
gainstaa

When statements?

Recommended Posts

gainstaa

Well what I want this to do is search for the pixel, click it, hold F3, then when the pixel 465, 35 turns 0x212121 it executes that section.

What it does now is search, click, F3, (If the pixel hasn't changed then it searches again, thus making it click around forever until it changes.) I want to to do nothing until the pixel changes, or if the pixel doesn't change in 10 seconds then it searches again. I'm still working on it now, I'll post back if I can figure it out before someone is able to tell me if it is possible or not.

I guess what I'm trying to say is there a way to make it search, click, hold F3 for 10seconds, and during that 10 seconds if the pixel changes then to do that part. But if the 10 seconds runs out then to search again.

HotKeySet( "\", "exit1")

sleep(2000)
while 1 = 1
    $color = 0x475147
    $coord = PixelSearch( 33, 135, 975, 492, $color ,2) 
    If not @error then
        MouseClick("left", $coord[0], $coord[1], 2, 0)
        Send("{F3 down}")
        If PixelGetColor ( 465, 35 ) = 0x212121 then
            sleep(1500)
            Send("{F3 up}")
            sleep(500)
            send("e")
            send("e")
            send("e")
            sleep(500)
            send("{d down}")
            sleep(300)
            send("{d up}")
            sleep(1000)
            send("{F8}")
            send("{F8}")
            send("{F8}")
            send("{F8}")
            send("{F8}")
            sleep(9000)
            send("{F6}")
            send("{F6}")
            send("{F6}")
            send("{F6}")
            send("{F6}")
            send("{F6}")
            sleep(2000)
        endif
    endif
wend

Func exit1()
    Exit (0)
EndFunc

Thanks,

Mark

Edited by gainstaa

Share this post


Link to post
Share on other sites
gainstaa

HotKeySet( "\", "exit1")

sleep(2000)
while 1 = 1
    $pwnd = 0
    $color = 0x475147
    $coord = PixelSearch( 33, 135, 975, 492, $color ,2) 
    If not @error then
        MouseClick("left", $coord[0], $coord[1], 2, 0)
        sleep(400)
        Send("{F3 down}")
        sleep(200)
        while $pwnd = 0
            If PixelGetColor ( 465, 35 ) = 0x212121 then
                sleep(1500)
                Send("{F3 up}")
                sleep(500)
                send("e")
                send("e")
                send("e")
                sleep(500)
                send("e")
                send("e")
                send("e")
                sleep(500)
                send("{d down}")
                sleep(800)
                send("{d up}")
                sleep(700)
                send("{F8}")
                send("{F8}")
                send("{F8}")
                send("{F8}")
                send("{F8}")
                sleep(9000)
                send("{F6}")
                send("{F6}")
                send("{F6}")
                send("{F6}")
                send("{F6}")
                send("{F6}")
                sleep(2000)     
                $pwnd = 1
            endif
        WEnd
    endif
Wend

Func exit1()
    Exit (0)
EndFunc

Ok so now it does it exactly as I wanted, but if it "misses the click", as in it clicks the color just not the one I wanted (happens like 1/10), then it stops and does nothing (As it is in the loop waiting for the pixel to change color). So is there anyway after being in the loop waiting for the pixel to change color, that if it doesn't in 10 seconds exit the loop (aka restart the script).

Share this post


Link to post
Share on other sites
gainstaa

HotKeySet( "\", "exit1")

sleep(2000)
while 1 = 1
    $pwnd = 0
    $timer = 0
    $color = 0x475147
    $coord = PixelSearch( 33, 135, 975, 492, $color ,2) 
    If not @error then
        MouseClick("left", $coord[0], $coord[1], 2, 0)
        sleep(400)
        Send("{F3 down}")
        sleep(200)
        while $pwnd = 0
            If PixelGetColor ( 465, 35 ) = 0x212121 then
                sleep(1500)
                Send("{F3 up}")
                sleep(500)
                send("e")
                send("e")
                send("e")
                sleep(500)
                send("e")
                send("e")
                send("e")
                sleep(500)
                send("{d down}")
                sleep(800)
                send("{d up}")
                sleep(700)
                send("{F8}")
                send("{F8}")
                send("{F8}")
                send("{F8}")
                send("{F8}")
                sleep(9000)
                send("{F6}")
                send("{F6}")
                send("{F6}")
                send("{F6}")
                send("{F6}")
                send("{F6}")
                sleep(2000)     
                $pwnd = 1
            Else
                sleep(1000)
                $timer = $timer + 1
                If $timer = 10 Then
                    ExitLoop
                endif
            endif           
        WEnd
    endif
Wend

Func exit1()
    Exit (0)
EndFunc

Yay! It works, woot!

Share this post


Link to post
Share on other sites
gainstaa

HotKeySet( "\", "exit1")

sleep(2000)
while 1 = 1
    $pwnd = 0
    $timer = 0
    $color = 0x475147
    $coord = PixelSearch( 33, 135, 975, 492, $color ,2) 
    If not @error then
        MouseMove($coord[0], $coord[1], 0)
        sleep(200)
        MouseClick("left")
            If PixelGetColor ( 465, 35 ) = 0xF9615F then                
                sleep(400)
                Send("{F3 down}")
                sleep(200)
                while $pwnd = 0
                    If PixelGetColor ( 465, 35 ) = 0x212121 then
                        sleep(1500)
                        Send("{F3 up}")
                        sleep(500)
                        send("e")
                        send("e")
                        send("e")
                        sleep(500)
                        send("e")
                        send("e")
                        send("e")
                        sleep(500)
                        send("{d down}")
                        sleep(800)
                        send("{d up}")
                        sleep(700)
                        send("{F8}")
                        send("{F8}")
                        send("{F8}")
                        send("{F8}")
                        send("{F8}")
                        sleep(9000)
                        send("{F6}")
                        send("{F6}")
                        send("{F6}")
                        send("{F6}")
                        send("{F6}")
                        send("{F6}")
                        sleep(2000)     
                        $pwnd = 1
                    endif
                wend
            endif   
    endif
wend

Func exit1()
    Exit (0)
EndFunc

There done, and it works better than I ever planned on it doing.

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.