Jackel192 Posted September 2, 2017 Share Posted September 2, 2017 i recently made a short "game", if you could call it that. it's a simple guessing game called Key and Lock. the object is two look at two objects represented by the C64's Character set and guess if it will fit the lock, represented by an x. my question is this: is there an alternative to the WAIT command for the c64. i want the program to wait for a keypress then give the result. example: This is a key will the key fit the lock? (wait for keypress) it fits, good job or if the key does not fit (wait for key press) it does not fir, too bad also, is there a way to space out the lines so its not bunched up? thanks in advance (p.s, i tried the IF command for a$ and got an error. i need a workaround.) Quote Link to comment Share on other sites More sharing options...
TMR Posted September 2, 2017 Share Posted September 2, 2017 Waiting for the keypress is easy enough, use GET to read the keyboard and keep looping back if the result is null: 300 GET A$ 310 IF A$="" THEN 300 Spacing out the lines can be done a couple of ways; either use PRINT on it's own between two existing lines to print out a blank line or typing the existing lines as PRINT "[hit cursor down]will the key fit the lock?" which embeds a cursor down into the PRINT statement. Quote Link to comment Share on other sites More sharing options...
Jackel192 Posted September 7, 2017 Author Share Posted September 7, 2017 thanks Quote Link to comment Share on other sites More sharing options...
Jackel192 Posted September 7, 2017 Author Share Posted September 7, 2017 I keep getting an error if a$= "open door" goto 50 syntax error Quote Link to comment Share on other sites More sharing options...
TMR Posted September 8, 2017 Share Posted September 8, 2017 I keep getting an error if a$= "open door" goto 50 syntax error Because the syntax is wrong; they're called IF/THEN statements for a reason and you need an IF and a THEN for it to work! IF A$="OPEN DOOR" THEN GOTO 50 Actually, in Commodore BASIC you can skip the GOTO so... IF A$="OPEN DOOR" THEN 50 ...will work too. Quote Link to comment Share on other sites More sharing options...
carlsson Posted September 8, 2017 Share Posted September 8, 2017 Though it seems that at least Applesoft BASIC has the IF - GOTO syntax, so anyone used to that would try it on other dialects too. 1 Quote Link to comment Share on other sites More sharing options...
landgraf Posted September 9, 2017 Share Posted September 9, 2017 If - goto constructs work on the C64, too, if a$= "open door" goto 50, if a$= "open door" then 50 and if a$= "open door" then goto 50 should all do the same, the syntax error must be caused by something else. I'd check for hard to spot typos like AS instead of A$, ; instead of : or something like that. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.