Qbasicnews.com
December 09, 2019, 03:16:15 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Question about time  (Read 3659 times)
Demon Red Storm
New Member

Posts: 3


« on: June 12, 2008, 07:06:10 PM »

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.
« Last Edit: June 12, 2008, 09:06:51 PM by Demon Red Storm » Logged
LPG
Member
*
Posts: 61

semper ubi sub ubi (always wear under wear)


« Reply #1 on: June 13, 2008, 12:38:33 AM »

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
Logged

WHILE RPG$ <> "complete" : make up silly excuses :WEND
LPG
Member
*
Posts: 61

semper ubi sub ubi (always wear under wear)


« Reply #2 on: June 13, 2008, 05:13:40 AM »

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.
Logged

WHILE RPG$ <> "complete" : make up silly excuses :WEND
LPG
Member
*
Posts: 61

semper ubi sub ubi (always wear under wear)


« Reply #3 on: June 13, 2008, 05:45:27 AM »

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
Logged

WHILE RPG$ <> "complete" : make up silly excuses :WEND
Demon Red Storm
New Member

Posts: 3


« Reply #4 on: June 13, 2008, 02:22:43 PM »

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.
« Last Edit: June 15, 2008, 01:03:00 PM by Demon Red Storm » Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!