feelin' sleepy

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
Hrothgar
Coder
Posts: 25
Joined: Tue Nov 22, 2005 8:32 pm
Location: Perth, Oz

feelin' sleepy

Post by Hrothgar »

Is there a way to get my program to wait for a certain amount of time that doesn't have the problem SLEEP does whereby if you push any key it skips the wait?

I thought about using TIMER but I was wandering if there were any other alternatives?

Edit: forget it I didn't realise there were any other parameters for "SLEEP" :oops:
Image
Towels may be harmful if swallowed in large quantities.
Patz QuickBASIC Creations
Veteran
Posts: 399
Joined: Wed Mar 02, 2005 9:01 pm
Location: Nashville, Tennessee
Contact:

Post by Patz QuickBASIC Creations »

I only recommend SLEEP if you want the user to be able to get out of it by pressing a key. If not, use this DELAY sub.

Code: Select all

SUB Delay (sec!)
LET stoptime! = TIMER + sec!     'sec! is the amount of delay in seconds
WHILE TIMER <> stoptime!
IF stoptime! > 86400 THEN stoptime! = stoptime! - 86400   'Midnight fix.
WEND
END SUB
I added the Midnight Fix because moneo reminded me about it in an earlier topic. :P
Z!re
Veteran
Posts: 887
Joined: Wed Aug 04, 2004 11:15 am

Post by Z!re »

Patz QuickBASIC Creations wrote:I only recommend SLEEP if you want the user to be able to get out of it by pressing a key. If not, use this DELAY sub.

Code: Select all

SUB Delay (sec!)
LET stoptime! = TIMER + sec!     'sec! is the amount of delay in seconds
WHILE TIMER <> stoptime!
IF stoptime! > 86400 THEN stoptime! = stoptime! - 86400   'Midnight fix.
WEND
END SUB
I added the Midnight Fix because moneo reminded me about it in an earlier topic. :P
He's using freebasic.. sleep delayms, 1
I have left this dump.
Post Reply