home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
No Fragments Archive 10: Diskmags
/
nf_archive_10.iso
/
MAGS
/
POWERMAG
/
POWER16.MSA
/
POWER_16
/
STOSTIPS.PWR
< prev
next >
Wrap
Text File
|
1985-11-20
|
6KB
|
137 lines
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~ Some Handy STOS tips! ~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BY CHRIS SHARP
This explanitory file is going to explain how simple programming
methods can be utilised in STOS.
Firstly, we need to know a few things before we can even start to write our
own programs.
When you first load STOS basic, you are greeted with a 'Menu Bar' at the
top of the screen, and a mouse cursor in roughly the middle of the screen.
The 'Menu Bar' contains 10 very helpful commands, which we can use
by pressing the functions keys from F1 to F10. Pressing and holding the
Shift key displays another ten commands. These can be used by holding down the
Shift key, and pressing the function keys F1-F10.
This is all very useful when we are writing our own programs, but when
we want our program to run, the Menu Bar doesn't dissapear. It isn't very
professional to leave this Menu Bar at the top of the screen, so somehow
we have to get rid of it.
The easiest (and possibly the only )way to get rid of it is by typing a
shoft command at the very start of our program. The command is KEY OFF,
so to use it in our program, we would type the following -:
10 KEY OFF
As long as this command is at the start of your program, when it is
run, the 'Menu Bar' will dissapear, leaving much more room for your
program.
Now that we have solved this problem, another becomes apparant. The Mouse
Cursor does not dissapear when the program is run. That would not be a
problem if the program you were writing needed to utilise the Mouse
Cursor, but if it did, because you were coding a 'Space Invaders' game
or similar, then you would need a way to get rid of it.
Again, there is a command to get rid of the Mouse Cursor, and this is the
HIDE ON command. This can be used by putting the following line at the
start of your program -:
10 HIDE ON
Great, so that works too, but now the 'Menu Bar' has come back when the
program is run. What we need to do is devise a small piece of code that
would make sure that both the Mouse Cursor, and the 'Menu Bar', did not
show up during the time the program was running.
There are a number of possible ways to do this, and 2 have been shown
below-:
You could put the following 2 lines at the start of your program -:
10 KEY OFF
20 HIDE ON
Well, this works fine, but it doesn't exactly make full use of the STOS
Basic Interpreter program.
A better way of doing it is as follows-:
10 KEY OFF : HIDE ON
Do you see how we have placed 2 commands on the same line? We can do
this by putting a colon symbol to space the 2 commands out. We can do
this as many times as we like, so we could have three or more instructions
to a single line number by typing the following-:
10 KEY OFF : HIDE ON : PRINT
it is generally a good idea to try and have not more than 4 instructions
to a single line number because once you start to cram too many commands
into a single line, the code begins to become unmanageable.
Great, so you have managed to get rid of the unwanted Menu Bar and the
mouse cursor, but there is still the problem of the flashing cursor, which
you must admit would not look good if it were flashing away, while a game
was running. The way to get rid of the cursor is to place FLASH OFF at
the start of your program, at roughly the same place as the KEY OFF and
CURS OFF commands.
We could get rid of all three, by placing the following line at the
start of our program -:
10 KEY OFF : HIDE ON : CURS OFF
O.K, so we have managed to get rid of the Menu Bar, the Mouse Cursor, and
the Text Cursor. All we need to do now is to make sure that there isn't
any unwanted information cluttering up the screen. We can do this by
placing a CLS, which stands for 'Clear the Screen', at the start of
the program. This makes sure that there is not any unwanted information
on the screen that shouldn't be there.
So, to set up the screen, all we need to do is type the following line, and
the screen is ready for anything that you want to place on it.
10 KEY OFF : HIDE ON : CURS OFF : CLS
However, when playing music back through STOS which will be explained
later, if a key is pressed, the music does not like this, and starts
breaking up. It only breaks up for a second, but it doesn't sound very
professional. To disable key clicking and make sure that the music is not
interfered with, all we need to do is place a CLICK OFF command at the
start of the program, like so-:
10 KEY OFF : HIDE ON : CURS OFF : CLS
20 CLICK OFF
Do you see how I have started to use a new line number? I have done this
simply because the first line has 4 instructions, and as expllained
earlier, more than 4 instructions to a line tends to be a recipe for
disaster. This is easily overcome by starting a new line.
Notice that the line number started at 10 and went straight up to 20.
The reason line numbers start at 10 and go up in multiples of 10 is
simply because -: If you later find out that you have missed a line out
of your program, you can place it in line number 15. If however, you had
started your line number at line 1, and carried on in multiples of 1,
there would have been no where else for the extra line to go, as you
cannot have line numbers 1, 1.5, and 2. Supposing you did start at 1 and
carried on in multiples of 1, so that you had a program with line numbers
1, 2, 3, 4, 5 and 6, and you needed to place an extra 3 instructions in
between line 2 and 3, where would they go? You cannot have line 2.5,
so you would have to join them to the start of line 3, and this often leads
to problems. So, make sure that you always start number lines from 10 and
you go up in multiples of 10. It often saves an enormous amount of
time if you have to add extra commands.