I'm having trouble with a program I am trying to write for my PCjr, where I need to pause the program for an amount of time before running the next instruction. Here it is:
10 CLS
20 PRINT "|"
30 WAIT 1
40 CURSOR 1,1
50 PRINT "/"
60 WAIT 1
70 CURSOR 1,1
80 PRINT "-"
90 WAIT 1
100 CURSOR 1,1
110 PRINT "\"
120 WAIT 1
130 CURSOR 1,1
140 GOTO 20
When I ran this program I got:
|
Syntax error in 30
Ok
30 WAIT 1
Is there a command that waits some number of seconds defined by a number or variable that I can use in place of "WAIT n"?
I have tried replacing "WAIT n" with "SLEEP n", however that didn't help as it ultimately gave me:
|
Syntax error in 30
Ok
30 SLEEP 1
I ended up reverting the change after this.
GW-BASIC and its derivatives (which include the BASIC you’re using) didn’t have a WAIT
or SLEEP
statement that would do what you are looking for. Generally, the desired effect was achieved by using a FOR...NEXT
loop:
10 FOR I=1 TO 1000: NEXT I
where the delay desired was multiplied by a fixed amount (usually, the estimate was a count of 1000 was about one second) as the upper bound on the FOR
.