AllExperts > Experts 
Search      

Qbasic, Quickbasic

Volunteer
Answers to thousands of questions
 Home · More Questions · Answer Library  · Encyclopedia ·
More Qbasic, Quickbasic Answers
Question Library

Ask a question about Qbasic, Quickbasic
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Alex Barry
Expertise
I have been a qbasic programmer since 2000, creating games, minor libraries and various small programs. I have experience using interrupts, graphics, file input/output, the mouse cursor, and using libraries. I have also learned FreeBASIC, c/c++, python, php and html.
I do not claim to be an absolute authority in any language, but I don't mind looking things up and learning with you.

Experience
Hobby programming since 2000

I no longer belong to any community programming groups, but do have knowledge of *basic dialect and C/C++
 
   

You are here:  Experts > Computing/Technology > Basic > Qbasic, Quickbasic > INKEY$ not working in SCREEN 13

Topic: Qbasic, Quickbasic



Expert: Alex Barry
Date: 6/27/2008
Subject: INKEY$ not working in SCREEN 13

Question
    Is it normal for INKEY$ not to work in SCREEN 13? I wrote a cat and mouse game a while back that took keyboard inputs like...
    IF INKEY$ = CHR$(0) + "H" THEN CatY = CatY - 1
   ...and so on. I tried to copy that exact phrase, except with ManY instead of CatY, into a SCREEN 12 program to move a man like my cat did previously.
    It didn't work.
    All other aspects of program work fine and I used a simple PRINT statement to verify that it wasn't registering and subtracting 1 from ManY.
    I'm very confused; please help me.

Answer
Hi, Tracy,

the INKEY$ function works in any screen mode, so it isn't a problem with INKEY$.

Can I see more of your code?  You may be doing something that stops the INKEY$ functionality, or something like that.

One tip I will give you though, is to define a 2 character string, call it keypress or something like that, and at the top of your game loop, do this:

keypress = INKEY$

This actually makes your program go a little faster, because it empties the keyboard buffer, which is good.

Also, just in case you didn't know, to make a 2 character string, do this:

DIM keyress AS STRING * 2

Anyway, if you can send me more code, I can help

Alex

View Follow-Ups    Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.