Page 1 of 1

input time delay

Posted: Thu Aug 25, 2005 2:48 pm
by Seb McClouth

Code: Select all

Do
    A$=inkey$
    if A$ <> "" then
      CMD$ = CMD$ + A$
    end if
    locate y, 2: PRINT CMD$
loop until cmd$ = chr$(13) or ...
I need it this loop a time counter. Either you press any key within a certain amount of seconds or if you don't the loop stops after the certain amount of seconds. How can I achieve this?

grtz
Seb

Posted: Thu Aug 25, 2005 10:33 pm
by The Awakened

Code: Select all


StartTime! = TIMER     'you could make it an integer if precise timing is not needed

Do
    A$=inkey$ 
    if A$ <> "" then 
      CMD$ = CMD$ + A$ 
    end if 
    locate y, 2: PRINT CMD$ 
loop until cmd$ = chr$(13) or TIMER - StartTime! < AmountOfSeconds

:)

I still havn't finished the Kiwi Bird... damn that thing is hard to draw... :D

Posted: Fri Aug 26, 2005 12:48 am
by Seb McClouth
Well keep it up. You're getting there!!

grtz
Seb

Posted: Fri Aug 26, 2005 4:46 pm
by Michael Calkins
You might put this inside the loop:

IF starttime! > t! THEN
'crossed midnight, timer went to 0
starttime! = starttime! - 86400
END IF

Regards,
Michael

Posted: Fri Aug 26, 2005 11:16 pm
by The Awakened
Yeah, I didn't include the midnight error handler because I knew he got it from another thread. :)