basicc64commodore

Why is there an unexpected character on line 6 in C64 Basic?


PRG Studio says there is an unexpected character on line 6. But, I can't figure out why. I'm programming for the c64.

1 rem setup
3 holding = "nothing"
6 playing_game = true
10 rem intro
20 print "it is dark. you have hiked miles to get here."
30 gosub 10000 rem wait
40 print "you have come to explore the castle of chadon hill."
50 gosub 10000 rem wait
60 print "it is said to have many traps. it is abandoned."
70 gosub 10000 rem wait
80 print "nobody has ever came back out..."
90 gosub 10000 rem wait
10000 rem wait
10010 waitcount = 0
10020 while waitcount < 50: waitcount = waitcount + 1: next waitcount
10030 return

I tried to change the "" to '', but that didn't work, I tried changing true to "true". That did nothing.


Solution

  • Your code won't work as you desire:

    • C64 BASIC, like most early Microsoft-derived BASICS, used numeric 0 (for false) and -1 (for true) for booleans.

    • The underscore _ was not one of the allowed characters; this is the source of the error message you're receiving.

    • String variables required the string indicator, $ - the variable holding is presumed to be numeric; to make it a string, name it holding$. I'm surprised you're not getting a type mismatch error in line 3.