Sign in to follow this  
Followers 0
Nazo

Multi PixelSearch with buttons sending

1 post in this topic

#1 ·  Posted (edited)

Global $Paused = 1 ; Paused
Global $Time = 0
Global $Time2 = 0
Global $Time3 = 0
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{Insert}", "Terminate")
AdlibEnable("Addfunction", 100)
AdlibEnable("Addfunction2", 100)
AdlibEnable("Addfunction3", 100)

while 1
    Sleep(100)
If $Paused = 1 Then
    ToolTip('P',0,0)
    Sleep(100)
EndIf
wEnd

Func TogglePause()
    If $Paused = 1 Then
        $Paused = 0
        ToolTip("")
    Else
        $Paused = 1
    EndIf
EndFunc

Func Addfunction()
    If $Paused = 0 Then
        $coord = PixelSearch( 0, 56, 140, 56, 0x054eb3)
            If Not @error Then
                $Time += 100
                    If $Time = 15000 Then
                        Send("{F11}")
                        $Time = 0
                    EndIf
            EndIf
    EndIf
EndFunc

Func Addfunction2()
    If $Paused = 0 Then
        $coord = PixelSearch( 0, 42, 121, 42, 0xaa0316)
            If Not @error Then
                $Time2 += 100
                    If $Time2 = 15000 Then
                        Send("{F10}")
                        $Time2 = 0
                    EndIf
            EndIf
    EndIf
EndFunc

Func Addfunction3()
    If $Paused = 0 Then
        $coord = PixelSearch( 0, 28, 136, 28, 0x9f682c)
            If Not @error Then
                $Time3 += 100
                    If $Time3 = 500 Then
                        Send("{F12}")
                        $Time3 = 0
                    EndIf
            EndIf
    EndIf
EndFunc

Func Terminate()
    Exit 0
EndFunc

This program should search for 3 different colours and then send 3 different buttons with specific delays but only last function is activated while program is unpaused. I need them all activated on the same time and when i'll pause program again it must stops immediately without ending started functions.

What should i change here?

Edited by Nazo

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  
Followers 0