Sign in to follow this  
Followers 0
SweatyOgre

PixelCheckSum time out?

5 posts in this topic

Is there a way i could set an amount of time for a pixel checksum to timeout after? I know it would involve creating a new function that involves a pixelchecksum.

Share this post


Link to post
Share on other sites



You could create a function that starts a timer as soon as it is called. You then loop a PixelSearch call, and after each search, test to see if the timer is greater than your timeout time. If it did timeout, you might want to return a -1, otherwise return the coordinates.


[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Share this post


Link to post
Share on other sites

Could you please explain Timers more in depth to me? The helpfile makes it a little confusing to understand how to apply them. And even though I don't think it matters, this is for a PixelCheckSum, not a PixelSearch.

Share this post


Link to post
Share on other sites

Could you please explain Timers more in depth to me? The helpfile makes it a little confusing to understand how to apply them.

You start a timer with the TimerStart() call, and it returns a number representing when that timer started. Whenever you call the TimerStop($var) function, it will return the amount of time that has elapsed between the time whan you set $var with TimerStart. Here is an example:

$timer = TimerStart() ;define a new timer
Sleep(3000) ;3 second pause
$result = TimerStop($timer)
MsgBox(0, "result", "the timer time was: " & $result)

Now, what I suggested was to test the timer in a loop. Like this:

$timer = TimerStart() ;define a new timer
While 1
  Sleep(100)
 ;do stuff here
 ;if timer is longer than 10 seconds, exit the loop
  If TimerStop($timer) > 10000 Then ExitLoop
WEnd

You might also want to set a variable if the timer expired rather than your loop ending normally.

And even though I don't think it matters, this is for a PixelCheckSum, not a PixelSearch.

Well, it would change how I would suggest you solve the problem :D. The above example won't "time out" the checksum because all script execution is paused while it checksums.

To solve that problem, you'll probably want to have a 2nd instance of your program, and have the main process either ignore (and let the checksum of the 2nd instance expire) or have it kill the 2nd process when the timeout value occurs.


[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Share this post


Link to post
Share on other sites

Thanks, I now fully understand Timers :D

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