Sign in to follow this  
Followers 0
Rauchster

When Colors Change

2 posts in this topic

I'm trying to make a function that monitors 4 different pixels at the same time, and when any of them change, it would send a keystroke different for each one, can send multiple keystorkes at the same time if 2 or more pixels change at the same time.

I can write a basic code that monitors each one in order, but can't figure out a code that monitors them all at the same time.

Anybody got a suggestion? I know I'm still a relative beginner but I am trying to learn.

This is what the code currently looks like...

All the variables are quite accurate, and it does work to a minimal degree, just doesn't scan them all concurrently, so it can't pick up multiple keystrokes, or if they come in a different order than how I have it scan.

$Uparrowx = 659
$Uparrowy = 368
$Uparrowcolor= 3739446

$Leftarrowx = 525
$Leftarrowy = 367
$Leftarrowcolor = 10505278

$Rightarrowx = 727
$Rightarrowy = 364
$Rightarrowcolor = 10507325

$Downarrowx = 593
$Downarrowy = 371
$Downarrowcolor = 13682269

Func UpArrowCheck()
    Do
        $Uparrowcheck = PixelGetColor ($Uparrowx, $Uparrowy)
    Until 1=1
    If $Uparrowcheck <> $Uparrowcolor   Then 
        Send ("{Up}")   
    ElseIf $Uparrowcheck = $Uparrowcolor    Then 
        Call ("LeftArrowCheck")     
    EndIf
    EndFunc

Func LeftArrowCheck()
    Do
        $Leftarrowcheck = PixelGetColor ($Leftarrowx, $Leftarrowy)
    Until 1=1
    If $Leftarrowcheck <> $Leftarrowcolor   Then 
        Send ("{Left}") 
    ElseIf $Leftarrowcheck = $Leftarrowcolor    Then
        Call ("RightArrowCheck")
    EndIf
    EndFunc

    
Func RightArrowCheck()
    Do
        $Rightarrowcheck = PixelGetColor ($Rightarrowx, $Rightarrowy)
    Until 1=1
    If $Rightarrowcheck <> $Rightarrowcolor     Then 
        Send ("{Right}")    
    ElseIf $Rightarrowcheck = $Uparrowcolor     Then 
        Call ("DownArrowCheck") 
    EndIf
    EndFunc

Func DownArrowCheck()
    Do
        $Downarrowcheck = PixelGetColor ($Downarrowx, $Downarrowy)
    Until 1=1
    If $Downarrowcheck <> $Downarrowcolor       Then 
        Send ("{Down}") 
    ElseIf $Downarrowcheck = $Downarrowcolor    Then 
        Call ("UpArrowCheck") 
    EndIf
    EndFunc

Call ("UpArrowCheck")

Share this post


Link to post
Share on other sites



Look at AdlibEnable(), /AutoIt3ExecuteScript, or write 4 separate apps that write to a file where you can monitor by reading it.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

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