Sinclair QL Beginner's Manual page 18

Hide thumbs Also See for QL:
Table of Contents

Advertisement

Colours have codes as described below.
For example, INK 3 would give magenta in MODE 8 and red in MODE 4.
We will explain in a later chapter how the basic colours can be 'mixed' in various ways to produce a
startling range of colours, shades and textures.
RANDOM EFFECTS
You can get some interesting effects with random numbers which can be generated with the RND
function. For example:
PRINT RND (1 TO 6)
will print a whole number in the range 1 to 6, like throwing an ordinary six-sided dice. The following
program will illustrate this:
NEW 
10 LET die = RND(1 TO 6) 
20 PRINT die 
RUN 
If you run the program several times you will get different numbers.
You can get random whole numbers in any range you like. For example:
RND(0 TO 100)
will produce a number which can be used in scale graphics. You can re-write the line program so that
it produces a random colour. Where the range of random numbers starts from zero you can omit the
first number and write:
RND(100)
NEW 
10 PAPER 7 : CLS 
20 INK RND(5) 
30 LINE 50,60 TO RND(100),RND(100) 
RUN 
This produces a line starting somewhere near the centre of the screen and finishing at some random
point. The range of possible colours depends on which mode is selected. You will find that a range of
numbers 'something TO something' occurs often in SuperBASIC.
BORDERS
Code
8 colour
0
black
1
blue
2
red
3
magenta
4
green
5
cyan
6
yellow
7
white
Effect
4 colour
black
black
red
red
green
green
white
white

Advertisement

Table of Contents
loading

Table of Contents