Writting program with QB64, need help!

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
User avatar
rileyil77
Newbie
Posts: 8
Joined: Sat Jun 09, 2012 5:26 pm
Location: Pontotoc, MS
Contact:

Writting program with QB64, need help!

Post 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.
Riley Personal Computer Doctor
We service from Memphis, TN. to Birmingham, AL.
For free Computer-Tech Support
or ProBoard BBS software support
http://rileypcmd.com
I wish to God I did know now the things I did know then.
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Re: Writting program with QB64, need help!

Post 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" 
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
User avatar
rileyil77
Newbie
Posts: 8
Joined: Sat Jun 09, 2012 5:26 pm
Location: Pontotoc, MS
Contact:

Re: Writting program with QB64, need help!

Post 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.
Riley Personal Computer Doctor
We service from Memphis, TN. to Birmingham, AL.
For free Computer-Tech Support
or ProBoard BBS software support
http://rileypcmd.com
I wish to God I did know now the things I did know then.
Post Reply