Page 1 of 1

feelin' sleepy

Posted: Mon Feb 20, 2006 7:19 am
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:

Posted: Tue Feb 21, 2006 1:04 pm
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

Posted: Tue Feb 21, 2006 1:33 pm
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