Remember the old "Choose your own adventure books" By D & D! ! !

Eric Christopherson echristopherson at gmail.com
Fri Jan 1 19:35:16 CST 2016


On Tue, Dec 22, 2015, Mike wrote:
>   IN Qbasic there is a SLEEP command as in...
> 
> 10 PRINT " HELLO WHAT IS YOUR NAME? " PNAME$
> 20 CLS
> 20 SLEEP=10 <----PAUSE FOR 10 SECONDS
> 30 PRINT "HELLO" PNAME$ "yOUR STARTING A ADVENTURE THAT WILL TAKE YOU
> THROUGH THE"
> 40 PRINT "MISTY MOUNTAINS "
> =============================================================
> 
> How would the sleep function work in basic I have tryed 10 sleeo=10, 10
> "sleep=5" its not working...

You have to make a loop that will last a certain amount of time. A
common thing was to say something like

    20 FOR I=0 TO 100:NEXT

-- varying the number after TO to produce a different length of delay.
Commodore BASIC is slow, but I'm sure a loop from 0 to 100 won't take
anywhere near 10 seconds; you can play around with it.

The more complex and more accurate way was to use the TI and TI$
variables to actually count off a given amount of time. If I remember
correctly, for 10 seconds it would be like this:

    20 TI$="000000"
    21 IF TI<(10*60) THEN 21

TI$ is a string that refers to the current system time (time since
poweron); the first two digits are hour, the second pair minutes, the
last two seconds. TI is a closely-related one that returns the number of
jiffies (1/60-second slices) in the system time. 10*60 converts jiffies
to seconds.

But I wouldn't impose this artificial wait; I certainly wouldn't want to
play a game that did that. Maybe you're just trying to make it more
period-correct by emulating 1541 loading times, in which case the delay
should be much longer ;)

-- 
        Eric Christopherson


More information about the cctalk mailing list