3

I've been recently learning commodore 64 BASIC and I'm trying to create a text adventure game, and I'm getting an error concerning all of the sleep functions I used. My code is:

20 SLEEP(1000)
30 PRINT CLS
40 INPUT "START SURVEY?" ANSWER$
50 IF ANSWER$ == "YES"
60 PRINT CLS
70 PRINT "YOU BEGIN THE SURVER"
80 SLEEP(1000)
90 ELSE
100 SLEEP(1000)
110 PRINT CLS
120 PRINT "COME BACK ANOTHER TIME"
130 SLEEP(1000)
140 PRINT CLS
150 GOTO 10

the error is

ARRAY AT LINE 20

any ideas on how to fix this?

1 Answers1

1

If your C64 doesn't have a version of BASIC greater than or equal to 7.0, SLEEP is not a C64 instruction

When the code is executed the interpreter recognize SLEEP as an undimensioned array because you used SLEEP() and therefore returns an error. If the statemente exist you have to use:

10 SLEEP 60

If SLEEP statement is not present, you should write some sub-routine to be called with the GOSUB statement that does a delay.

C64 Manual

Reading the appendix of the manual I saw that there is a WAIT statement, but to use such statement you should find some memory location updated by the C64 every clock (there should be, but I can't remember which one it is).

I have also found an answer here on Stackoverflow related to delay for VIC20/C64. It might be a good solution: How to wait x seconds in 6502 basic

SJB
  • 71
  • 8