#####################################################################
# Starting Qbasic                                                   #
# By Pickers Games                                                  #
# www.pickersgames.co.uk                                            #
# pickers@pickersgames.co.uk                                        # 
#####################################################################
#                                                                   #
# Welcome to this tutorial by Pickers Games, teaching               #
# you how to start programming in qbasic!!                          #
#                                                                   #
#####################################################################

===============================
The Beginning - What Is Qbasic?
===============================
For those of you that don't have a clue what qbasic is then take note. If you
know what it is but don't know how to use it then you can still use this to learn.
Qbasic is a computer programming language which anyone can use providing you learn the 
language as it is not a language which you type in english, you will need to learn a
specific language, which you can begin to learn as this tutorial goes on. What can I make 
with it?? Well you can make games, applications, utilities, sounds, etc. It is totally 
compatible with everything!! It is owned by Microsoft, and is free for you to use.

=====================
Part 1 - Using Qbasic
=====================

To use qbasic obviously you will need to have it present on your pc. 
Getting qbasic couldn't be easier, as it is available from the Pickers
Games Website, www.pickersgames.co.uk, from our site, you can download
either qbasic1.1 or qbasic4.5. We recommend that you download version 
4.5 as it has better features and runs programs faster!!  

===========================
Part 2 - Starting up Qbasic
===========================

Once you have qbasic on your pc, you should install it to somewhere 
where you know where it is. The to run qbasic go into the directory 
where qbasic is present and double-click on Qb.exe(version4.5) or
Qbasic.exe(version1.1). Once you have opened qbasic you will get a 
blue screen, where you type in the code. 

--------------------------------------------------------------------------------------
* To run the programs you will HAVE to press F5 *      - the same with all versions!!
--------------------------------------------------------------------------------------

==============================
Part 3 - Useful things to know
==============================

When you type in a ' in qbasic it tells qbasic to ignore whatever is after that, it is called
commenting, because it allows you to comment on your work, it is mainly used to remind yourself
of something so you dont forget!
It works like this:

' whatever you want to say

---------------------------------------------------------------------------------------------

Also don't worry about typing in capitals because qbasic will convert it for you, it is a good 
way of telling if you have put in a correct statement becasuse it will be transformed to capital
letters. So if it is not you know there is something wrong with your code.

==============================
Part 4 - The "print" statement
==============================

We will start this tutorial with the print statement, this is the
easiest function to learn in qbasic. A good place to start your 
qbasic careers!! It is used like this:

--------------------
print "Hello!!"
--------------------

Type this in on the main blue screen and then press F5 to see the 
first program you have done in qbasic!! This code should give
you a blank black screen with the words, which you put in the speech marks, so this program,
should just say :
~~~~~~~~
Hello!!
~~~~~~~~
On a blank black screen!! Now obviously to change what you want printed on the 
screen you just change what was in the speech marks :
------------------------------------------------
print "WHATEVER YOU WANT PRINTED ON THE SCREEN"
------------------------------------------------
However you should realise that after running the second program
the first program is still left on the screen. For example, after
you ran program 1 and then you made your own writing up then you 
got something like this :
~~~~~~~~~~~~~~~~~~~~~~~~~
Hello!!     
"Whatever You Typed In"
~~~~~~~~~~~~~~~~~~~~~~~~~
In other words whatever you did previously is still on the screen. To 
overcome this problem you will need to learn a simple function, which 
takes us to our next chapter!!

==================================
Part 5 - The Clear Screen Function
==================================

After learning in Part 2 that you need to clear the screen you will
be wondering what the code you need is, well don't worry it is still
very easy!! Take a look:

------------------------------
cls
print "Hello!!"
------------------------------

This is the Clear Screen Function, it is simply "cls"
This will clear the screen back to blank everytime you run a program. 
So you don't have your last program still on the screen. Easy isn't 
it!! You will need to put it on the first line of your program, so that
it will clear the screen before doing the next operation!!!

================
Part 6 - Screens
================

Qbasic has different screen modes depending on what you want to do!! Each screen mode has a 
different resolution for your text, and pictures!!

Screen 0 is the default screen. So if you don't assign a screen then qbasic will use this one!!
Screen 1 gives you really big text
screen 2 gives you a slightly bigger than screen 0 with an italic type of text
etc
There are 13 screens for you to try out!!
How to use the screen statement:

----------------------------------
cls
screen 9
print "hi"
----------------------------------

By using this code you will see the difference which the screens make, to change the screen
mode just change the number after the screen function. Just remember that you can use 0-13.

==============
Part 7 - Color
==============

So far what we have done has all been in plain black and white so why don't we spice it up a 
bit!! By using the color statement!! The color statement is just as easy as the other functions,
and can be used for you to use different colors on your programs!!
- color 0 - gives you black writing ( * note the screen will be blank because the writing and 
background colors are the same!!)
- color 1 - gives you blue writing
- color 2 - gives you a pretty green color
etc
There are up to 17 normal colors (0 - 16)!! From color 17 - 30 you can get flashing colored
text!! However some screens do not support flashing text eg screen 9
To write in a red color the code is :
* note - screen 0 has been chosen as it is a normal screen which supports flashing text!!

-------------------------------------
cls
screen 0
color 12
print "hi"
-------------------------------------

This shows hi in a red font!!
To write in a flashing red font :

------------------------------------
cls
screen 0
color 28
print "hi"
-------------------------------------

As you can see this shows "hi" in a red flashing text!!  

=================
Part 8 - Drawing
=================

Many programmers want to draw in qbasic and there are many different ways, depending on what you
want to do!! Here is the code to draw a circle in screen 2 :

---------------------------------
screen 12
circle (x , y), radius, color
---------------------------------

The x and y stand for the coordinates you want the circle at, so you define these a number
eg 10, the radius is how big you want your circle, eg 10, and the color is used the same as 
the color statement in part 6 so you also give that a number eg 3!!

-------------------------------------------
* Note : In screen 2 you cannot use colors!!!
-------------------------------------------

So an example of the code you could use would be :

---------------------------------------
cls
screen 2
circle (100,100),5,5
----------------------------------------

This will draw a small circle, to draw a larger circle, you just increase the radius!!
To draw a line in screen 2, (obviously where x and y are your starting points, and y and y2 are 
your finishing points) the code you need is:

--------------------------
line( x, y)-step( x2, y2)
--------------------------

We recommend screen 12 and 13, for drawing as they have the highest resolution.

============================
Part 9 - The Input Statement
============================

Input is a handy bit of qbasic code. What is it I hear you ask,well input means you can ask
the user a question and they can reply to it! Also as you learn more you can use the data 
entered by the user for different things.
_________________________
eg 1 - The Basic Question
-------------------------
The basic input statement is to ask a question to the user, to do this you use the following 
code :

--------------------------
CLS
INPUT "What is your name" ; q1$ 
-------------------------------

Please note you do not need a question mark because with input
'it automatically puts one in for you. Also the q1$ is there as qbasic stores the answer into
a variable called q1$ - there doesnt have to be a number just a letter or word, make sure its a 
good word so you remember what its for, i chose q because it is for question, it could have been
called question$, or anything! Although it has to be a $.
________________________
eg 2 - Using The Results 
------------------------
To use the results of your question is easy, it just involves the print statement which you have 
already learnt! I will show you two ways of displaying the answers to the question, D1 and D2:

D1 : 
--------------------------------
CLS
INPUT "What is your name" ; q1$ 
PRINT "Your name is " ;q1$
---------------------------------

This stores the answer into the variable q1$ and then you are telling qbasic to type the answer 
back out in the print statement. Please note to put a space after the "name" part in the input 
statement or it will print; name and whatever the variable is as 1 word.

D2 :
---------------------------------------------------
CLS
INPUT "What is your name" ; q1$ 
CLS
PRINT "Your name is " ;q1$ ;" and I dont like you"
----------------------------------------------------

All I have done which is different to D1 is I have added a clear screen so the print statement
is on a blank screen, and looks better. Also I have added an extra bit at the end of the print
statement, this is just something I thought may be useful, it just means the name is put into
the middle of a sentence.
____________________
eg 3 - Using numbers
--------------------

There is a few good things qbasic can do with numbers in the input statment, however you have 
to change the "$" to a "%" sign, so instead of being a variable it is stored as an integer
and qbasic knows that it is a number! This means if qbasic knows its a number you can do
some better things with it. Here is an example of how you tell qbasic you want the answer stored
as an integer :

--------------------------------------
CLS
INPUT "What is your age " ; age%
CLS
PRINT "So you are ";Age% ; " years old"
--------------------------------------- 

This puts the information into the integer age%, we can use this to perform simple sums :

------------------------------------------------------------------------------
CLS
INPUT "What is your age " ; age%
CLS
PRINT "So you are ";Age% ; " years old"
INPUT "What is your dads age " ; dadsage%
dadsage% - age% = differenceage%
CLS
PRINT "The difference in years between you and your dad is " ; differenceage%
--------------------------------------- --------------------------------------

This has included a sum in to work out the difference in years between you and your dad,
it is just a simple minus sum! And from this it has produced a new integer called
differenceage%, as you know this could be called anything!


------------------------------------------------------------------------------------------
This is the end of the StartingQB we hope it has helped be ready for part 2 and the other
tutorials that we will produce! 
Keep checking Pickers Games Website, at www.pickersgames.co.uk
If you have any problems I can be emailed at:
pickers@pickersgames.co.uk

------------------------------------------------------------------------------------------
thanks
Pickers    
Pickers Games
www.pickersgames.co.uk
StartingQB was finished on 06/01/01
----------------------------------------------------------------------------

    Source: geocities.com/wpsmoke