Sunblood Posted July 27, 2004 Posted July 27, 2004 I have a script that uses the following code: $timer = TimerStart() While 1 $dif = TimerStop() If $dif > 60000 Then Exitloop EndIf Wend (There is more to it that allows it to loop back again) The problem is, sometimes it will loop back around and the timer will still be going, and it will be longer than 60 seconds, thus instantly exiting the loop. How can start the timer over?
Administrators Jon Posted July 27, 2004 Administrators Posted July 27, 2004 I have a script that uses the following code: $timer = TimerStart() While 1 $dif = TimerStop() If $dif > 60000 Then Exitloop EndIf Wend (There is more to it that allows it to loop back again) The problem is, sometimes it will loop back around and the timer will still be going, and it will be longer than 60 seconds, thus instantly exiting the loop. How can start the timer over?Check the timerstop docs, you need to pass it $timer. $dif = TimerStop($timer)
Sunblood Posted July 28, 2004 Author Posted July 28, 2004 Check the timerstop docs, you need to pass it $timer. $dif = TimerStop($timer)Err, that was just a typo in the code I posted. I have that The timer still doesn't actually stop. It just finds the time since it started.
Valik Posted July 28, 2004 Posted July 28, 2004 That's because TimerStop() is incorrectly named... TimerStop(). It's new name (Which will be changed in the latest stable release) is TimerDiff() which is what it does (It is already changed in the unstable build). Why do you need to stop the timer? Do you need to reset it, perhaps? It's not actually a timer running using resources or anything, if that was what you were thinking...
Administrators Jon Posted July 28, 2004 Administrators Posted July 28, 2004 Err, that was just a typo in the code I posted. I have that The timer still doesn't actually stop. It just finds the time since it started.Oh ok, just reinit $timer then with TimerStart($timer)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now