Jump to content

Timer problems (Timerint, Timerdif)


Recommended Posts

Ok well lets start with the code...

HotKeySet("{TAB}", "TogglePause")
HotKeySet("{Delete}", "End")
Global $Paused = 0
$x = 1
$Timer = TimerInit()
$timepaused = 0

Do
    $x += 1
    if $x = 10 Then
        consolewrite("tick" & @crlf)
        [s]$timepaused = 0[/s] ;Duh this shouldnt be here! lol
        $x = 1
    EndIf
    sleep(100)
    while $paused
        consolewrite("Paused" & @crlf)
        sleep(1000)
    WEnd
until 1 = 2


func TogglePause()
$paused = not $paused
if $paused Then
$timer_ = TimerDiff($Timer)
$timepaused = $timer_ + $timepaused
elseif not $paused Then
    $Timer = TimerInit()
EndIf
EndFunc

Func End()
    consolewrite(TimerDiff($Timer) + $timepaused & @crlf & @crlf & @crlf & @crlf )
    Exit
EndFunc

I overlooked somthing... duh... lol. Works now.

Edited by The_Noob
Link to comment
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
 Share

  • Recently Browsing   0 members

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