Jump to content
Sign in to follow this  
FinalVersion

Timer Problems

Recommended Posts

FinalVersion

Current Code:

$TStart = TimerInit()

;Main Loop

While 1
    $Timer = TimerDiff($TStart)
    If $Timer = 1000 Then
        MsgBox(0, "", "Time!!")
    EndIf
    Sleep(30)
WEnd

I would put the timerinit in the loop but then that would keep resetting it.

Share this post


Link to post
Share on other sites
Dampe

$TStart = TimerInit()

;Main Loop

While 1
    $Timer = TimerDiff($TStart)
    If $Timer >= 1000 Then
        MsgBox(0, "", "Time!!")
    EndIf
    Sleep(30)
WEnd

Considering there is a sleep(30) there, it would be impossible to get an exact value of 1000, so use >= instead of =


Share this post


Link to post
Share on other sites
Spiff59

With your prior post regarding multiple timers, I'd think you'd want to be resetting your timers in the loop via TimerInit()

$TStart1 = TimerInit()
$TStart5 = TimerInit()

;Main Loop

While 1
    If TimerDiff($TStart1) > 1000 Then
        ToolTip("Timer1")
        Beep(600,50)
        $TStart1 = TimerInit()
    EndIf
    If TimerDiff($TStart5) > 5000 Then
        ToolTip("Timer5")
        Beep(900,50)
        $TStart5 = TimerInit()
    EndIf
    ToolTip("")
WEnd

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.