Sign in to follow this  
Followers 0
EvilOniLink

pixelchecksum help

6 posts in this topic

#1 ·  Posted

I can get the Pixelchecksum to tell me when something changes but now i want to install a timer so that if the pixels don't change for so many seconds then a different function is called. Any ideas? Here is how i have the pixelchecksum written:

 

Func Wait()
   
    For $i = 0 To $iMax
        Local $iCheckSum = PixelChecksum(1165, 377, 1352, 629)
        While $iCheckSum = PixelChecksum(1165, 377, 1352, 629)
            Sleep(Random(100, 500, 1))
         WEnd
         Sleep(Random(400, 500, 1))
        Newfunction()
     Next
     
     

EndFunc   ;==>Wait

Share this post


Link to post
Share on other sites



#2 ·  Posted

@EvilOniLink what application are you trying to automate? The method of your approach will vary depending upon what you are doing, and there is almost always (like 99.99%) a better way than pixel searches. What exactly is the application doing that you need a random sleep?


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#3 ·  Posted

I'm really new to all this so idk how to answer your questions. But any insight or attemps would be greatly appreciated. I tried modifying a Pixelgetcolor to use the pixelchecksum but i'm having difficulty with it. If i could change the pixelgetcolor to pixelchecksum that would be awesome. Thanks

$nX = 546
$nY = 380

;Get a color and pass it to function
$Color = PixelGetColor($nX, $nY)

;Wait for color to change or time out after 5 seconds.
$NewColor = _ColorWaitChanged($nX, $nY, $Color, 5000)
If @error Then
    MsgBox(0, "Error: " & @error, "Color did not change")
    Exit
EndIf

MsgBox(0, "Success", "Color changed to 0x" & Hex($NewColor, 6))

;###########################################################################
;Waits for passed color at the given co-ordinates to to change or time out.
;###########################################################################
Func _ColorWaitChanged($x, $y, $col = 0, $timeout = 0, $sleep = 100)
    Local $Timer
    If $timeout Then
        $Timer = TimerInit()
    EndIf
    Do
        If $timeout Then
            If TimerDiff($Timer) >= $timeout Then
                Return SetError(1, 0, 0)
            EndIf
        EndIf
        Sleep($sleep)
    Until (PixelGetColor($x, $y) <> $col)
    Return PixelGetColor($x, $y)
EndFunc   ;==>_ColorWaitChanged
 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

You posted more code (great), but didn't answer the question. What is the application (you shouldn't be so new you don't know the name of your application), and what specifically is it doing that you need a random sleep?

Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#5 ·  Posted

Idk know computer lingo, for all i know application means i'm applying for a job. sorry.

Share this post


Link to post
Share on other sites

#6 ·  Posted

That's funny, since from your previous posts you seem pretty computer literate. This code also seems very close to your game automation post before, which prompted me to ask. As you're being evasive, this thread is locked until you convince me otherwise.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0