object.settimer 1,10 should give me a 10 milisecond timer; one-hundredth of a second.
So if I counted by 10 every time, ontimer...
Sub Object_OnTimer1
milisec = milisec + 10
End Sub
...milisec should reach 1000 every second, on the second.
For a simple stopwatch I used the following code in a text object:
Code: vbscript
- Sub Object_OnTimer1
- If milisec > 999 Then
- milisec = 0
- sec = sec + 1
- If sec > 59 Then
- min = min + 1
- sec = 0
- End If
- If min > 59 Then
- hr = hr + 1
- min = 0
- End If
- If hr = 100 Then object.KillTimer 1
-
- Else
- milisec = milisec + 10
- End If
- txt = "0"
- If len(milisec) = 1 Then
- milisec = txt & txt & milisec
- Elseif len(milisec) = 2 then
- milisec = txt & milisec
- End if
- If len(sec) = 1 Then sec = txt & sec
- If len(min) = 1 Then min = txt & min
- If len(hr) = 1 Then hr = txt & hr
- Object.text = hr & ":" & min & ":" & sec & ":" & milisec
- End Sub
I let it run side by side with my system clock and my stopwatch is slower than the system time. It takes roughly TWO seconds for milisec to count to 1000. Am I missing something painfully obvious here?