Jump to content

pixelchecksum help


Recommended Posts

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

Link to comment
Share on other sites

  • Moderators

@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?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

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
 

Link to comment
Share on other sites

  • Moderators

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

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Moderators

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.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...