Page 1 of 1

Writting program with QB64, need help!

Posted: Sat Jul 06, 2013 6:06 pm
by rileyil77
Friends,

Sorry, to ask, but I just recently started programming again. I thought... And I known I'm going to sound retarded, but I thought for example if I was doing say code like this:

Code: Select all

'Inspection Software
'
' Written By:            John Riley
' 
' Version:              1.2013.7.5
'
' Written with QB64.
' Converted to Web Appilcation with Virtual Basic 2008.
' Compiled with Alpha 5 version 11.
'
PRINT "Welcome to the Inspection Software"
PRINT "     Version:  1.2013.7.5"
PRINT ""
PRINT "Written By:              John Riley"
PRINT ""
PRINT "Press ENTER to Continue"
PAUSE
PRINT "did it work?"
PRINT ""
I thought PAUSE was the command, however I get the error: Syntax Error on Current Line.
What is the command to pause and what for the enter key or any key to be pressed for that matter?
I feel so stupid, because back 20 years ago I programmed with QBasic at least once a week, now for week I've been fighting my pause problem.

Well, I guess, I wish to God I did know now the things I did know then.

Re: Writting program with QB64, need help!

Posted: Sat Jul 06, 2013 6:25 pm
by burger2227
SLEEP will wait until any key(except function keys) is pressed. Use k$ = INKEY$ after it to clear the key or it may end up in an INPUT later on.

K$ = INPUT$(1) 'will wait for any key press.

INPUT "", dummy$ 'will wait or take input until Enter is pressed.

You could also use a do loop for specific keys:

Code: Select all

PRINT "Press Y to continue:"
DO
  _LIMIT 10  'saves QB64 program resources 
  K$ = UCASE$(INKEY$)
LOOP UNTIL K$ = "Y" 

Re: Writting program with QB64, need help!

Posted: Sat Jul 06, 2013 6:49 pm
by rileyil77
burger2227 wrote:SLEEP will wait until any key(except function keys) is pressed. Use k$ = INKEY$ after it to clear the key or it may end up in an INPUT later on.

K$ = INPUT$(1) 'will wait for any key press.

INPUT "", dummy$ 'will wait or take input until Enter is pressed.

You could also use a do loop for specific keys:

Code: Select all

PRINT "Press Y to continue:"
DO
  _LIMIT 10  'saves QB64 program resources 
  K$ = UCASE$(INKEY$)
LOOP UNTIL K$ = "Y" 

Thanks, Burger2227. I am working on 2 programs at once, and this program a friend is paying me to write. The other is a personal project of mine that really requires no pausing at all. Speaking of which, in that program, I need a quick hand.

Code: Select all

aa$ = "A"
bb$ = "B"
cc$ = "C"
(All the way through to)
xx$ = "X"
yy$ = "Y"
zz$ = "Z"
Now we skip a ton of code and we get to the missing letter stuff.

Code: Select all

PRINT "Find the correct letter...  If the word your see is typed with the correct letter you can always as before press 1"
PRINT ""
INPUT xx$"elicopter"; answerw1$
Now I have two problems.... I want the program to use any random variable at the beginning of the word, out of the 26 I defined if it is possible and the last line is also giving me an error: Invalid expression on line 252.