Does anyone in there know anything about the timer? If so can you please give me some pointers. I really appreciate it.
Printable View
Does anyone in there know anything about the timer? If so can you please give me some pointers. I really appreciate it.
A timer in QBasic? :confused: Perhaps you meant to ask in the Visual Basic Forum...
Help file for "Timer" in QBasic
This covers pretty much everything about the timer... setting it up using timer on/off. Using the "On Timer(n%) Gosub line" you can execute a sub procedure if a certain time is reached.
I can't remember how it exactly works because it's a long time since I played with it, but stick that example at the bottom into basic, play with the numbers, and you'll see what everything does in no time. Hope that helps.
------------------------------------------------------------------------------------
TIMER enables, disables, or suspends timer event trapping.
If event trapping is enabled, ON TIMER branches to a subroutine whenever
a specified number of seconds has elapsed.
TIMER ON
TIMER OFF
TIMER STOP
ON TIMER(n%) GOSUB line
þ TIMER ON Enables timer event trapping.
þ TIMER OFF Disables timer event trapping.
þ TIMER STOP Suspends timer event trapping. Events are processed
once event trapping is enabled by TIMER ON.
þ n% The number of seconds that elapse before ON TIMER
branches to the event-trapping subroutine; a value in
the range 1 through 86,400 (24 hours).
þ line The label or number of the first line of the
event-trapping subroutine.
Example:
ON TIMER(1) GOSUB TimeUpdate
TIMER ON
CLS
PRINT "Time: "; TIME$
StartTime = TIMER
WHILE TimePast < 10
TimePast = TIMER - StartTime
WEND
END
TimeUpdate:
LOCATE 1, 7: PRINT TIME$
RETURN
------------------------------------------------------------------------------------