Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Question about time
#1
My question is this: what is the command to pause the computer's execution of a program for a certain number of cycles, if it exists? I want to create scrolling text, but this is the only roadblock. I don't want it to be in intervals of seconds, so using time$ will not work, as far as I know of. I read a little, and the TIMER function instead seems appropriate, but I am not sure yet. I am using QBasic 7.1 to program this, in case that is necessary at all.
Reply
#2
there are a few solutions for this problem.
this one works slow on slow computers and fast on fast computers.

Code:
for a = 1 to number : next a

where number is a number. a big number will cause a big rest.

you can also use timer

Code:
t = timer
do
loop until timer > t + interval

where interval is the number of seconds? or milliseconds? to wait. this does not work if you run the program over midnight as timer returns the number of seconds\milliseconds? elapsed since midnight
WHILE RPG$ <> "complete" : make up silly excuses :WEND
Reply
#3
you can also use this:

Code:
WAIT &H3DA, 8

i got it from http://www.acidworks.com

it waits until the screen is refreshed and can be used in animation to reduce flickering.
WHILE RPG$ <> "complete" : make up silly excuses :WEND
Reply
#4
this does timing of nineteenths of a second. i got it from the same site:

Code:
SUB DELAY (time%)
    DEF SEG = 0
    POKE (1132), 0
   CountDown:
    IF PEEK(1132) < time% THEN GOTO CountDown
    DEF SEG
END SUB
WHILE RPG$ <> "complete" : make up silly excuses :WEND
Reply
#5
K. Thanks for that. The only time I required a delay was an analog clock (like a grandfather clock) program I was working on. I think I can work around the "number of seconds and midnight" thing. It is the easiest syntax, as far as I can tell.

Anyway, please consider this closed. If you have another method, feel free to post it. However, I have all the information I need, as far as I know of. Thank you LPG, and any additional posters. Decided to leave this completely.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)