STOS BASIC 6 I assume little/no prior knowledge of Stos. Each lesson will also have a Stos BASic or ASCii file to go with it. Listed here for your convenience. i.e. to make it easier to write them down or to look at the structure of the command. Are the new commands to be dealt with. Do not worry if you find things hard at first, practice makes perfect. Actual progs are used to explain things, called 'name.asc' and included in this folder. The Main Commands: SET ZONE: RESET ZONE: BOX: IF THEN: FOR...NEXT: REPEAT...UNTIL: RESERVE SCREEN: SCREEN COPY: GET PALETTE: If you have any problems, then look for the command on pages 271/73 of the manual. This is not intended to replace the manual, but to add to it where needed. This programme does not work properly because line 80 needs to be changed. I am sort of hoping that by now you will have an idea as to what is wrong with it. To give you a clue F is too high or else the programme needs changed. The next lesson will show you how to put it right in case you get lost, so do not panic. LESSON 1 10 rem draw boxes 20 rem 30 if mode<>0 then mode 0 40 cls : key off 50 X=0 : Y=Y 60 X1=X : X2=X1+60 70 Y1=Y : Y2=Y1+60 80 for F=1 to 8 90 box X1,Y1 to X2,Y2 100 X1=X2+10 : X2=X1+60 110 next F lines: 10 rem draw boxes 20 rem Tells you what to expect from the programme. In this case it is just drawing boxes onto the screen. In the later lessons I shall show you how to create zones and use them to activate parts of your programmes - which is just the same as drawing boxes really. lines: 30 if mode<>0 then mode 0 40 cls : key off Set up the screen. As you merge these small programmes together, you will delete the screen setup from each small programme and write a larger one to cover them all. lines: 50 X=0 : Y=0 60 X1=X : X2=X1+60 70 Y1=Y : Y2=Y1+60 Set up the values for the size of the boxes to be drawn. In this case the boxes will be 60 by 60 in size and start at point (0,0). i.e. top left hand of the screen. I set up (X) and (X) as the starting points, and then tie the size of the box to this. If I change the value of x or y the boxes will change in size, but they might not fit onto the screen. That, by the way is why this programme does not work. line: 80 for F=1 to 8 Sets up the number of the boxes to be created, in this case 8. line: 90 box X1,Y1 to X2,Y2 Draws the box at point (x1,y1) and (x2,y2). By using a set of variables here I can get away with only one line of code, which will be executed 8 times instead of 8 lines of code being executed once. This is quicker to write, and quicker to alter. In this example there is not that much of a difference, as I also have to include the other lines of the (For..Next) loop, so in the end I only save a little bit of time. However if I want to move the boxes or resize them, then I only have to change lines 50 to 70 and the programme will draw them to the new place for me. line: 100 X1=X2+10 : X2=X1+60 Sets up the position of the next box to be drawn to screen. line: 110 next F Completes the loop and jumps back to line 80 until all 8 boxes have been drawn. Or it would do but for the fault. Have you worked it out yet? Well, Stos will not draw graphics off of the screen. That is to say at screen locations larger than the screen size. If you remember, I did mention this in an earlier tutorial. So whilst Stos will happily draw sprites off of the screen and then move them onto the screen. Just remember that it will not do the same for graphics!! Anyway The answer was to either make the boxes smaller so that all 8 would fit onto the screen, or to change the number of boxes to be drawn to screen, or to make stos draw the other 4 boxes under the first four. Now as I wanted eight boxes of that size, I obviously intended to add some more code to make it work. LESSON 2 10 rem draw boxes 20 rem 30 if mode<>0 then mode 0 40 cls : key off 50 X=0 : Y=0 60 X1=X : X2=X1+60 70 Y1=Y : Y2=Y1+60 80 for F=1 to 8 90 box X1,Y1 to X2,Y2 100 X1=X2+10 : X2=X1+60 110 if X1>=260 then X1=X :X2=X1+60 : Y1=Y2+10 :Y2=Y1+60 120 next F I have added a line at 110. Other than that it is the same programme that I have already discussed with you. lines: 10 rem draw boxes 20 rem Tell you what the programme does. lines: 30 if mode<>0 then mode 0 40 cls : key off Set up the screen. In this case it checks the screen resolution then turns off the key menu and clears the screen. lines: 50 X=0 : Y=0 60 X1=X : X2=X1+60 70 Y1=Y : Y2=Y1+60 Set up the values for the sizes of the boxes. lines: 80 for F=1 to 8 90 box X1,Y1 to X2,Y2 100 X1=X2+10 : X2=X1+60 Set up the number of boxes and where each one is drawn in relation to the previous one. line: 110 if X1>=260 then X1=X : X2=X1+60 : Y1=Y2+10 : Y2=Y1+60 The new line. This checks to see what the value of (x1) is. If, and only if, it is 260 or above, the programme reads the rest of the line. Otherwise it is ignored. Why 260? Well if you remember the boxes are 60 by 60 in size and the screen is 320 across by 199 down in size. So we need to take the size of the box away from the screen size, in order to know where we can draw the boxes. When and if (x1) reaches 260 or above the rest of the line gets read. The first part (X1=X) resets (X1) to zero because we did not change the value of (X). The second part (X2=x1+60) just resets the value of (X2) to 60 larger than the value of (X1). Before this command (X2) still held the value of (X1), before (X1) had its value changed to zero, so (X2) would have held a value above 300 in this case. Remember this line was read only because (X1) had a value too high to draw a box on the screen. It therefore follows that as (X2) was 60 greater than the value of (x1), that (X2) must also be changed. In this case (X1) was 280 and (X2) was 340. What you have done is to reset the value of (X2). line: 110 if X1>=260 then X1=X : X2=X1+60 : Y1=Y2+10 : Y2=Y1+60 This determines the maximum value that (X1) can have, and still draw a box on screen. As the size of the box is set at (60) and the screen is (320) across, and 320-60 = 260 then this is the largest value that we can allow (x1) to take. If you change the size of the box, then you will need to change the value of line 110 to match. line: 120 next F This loops the programme back to the (FOR F = ...) bit of the programme. In this case back to line 80 and increments the value of (F) each time until (F) reaches the set value for it, which in this case is 8. LESSON 3 Well, here we are. This is all of the previous lessons rolled into one, and tacked in there is also the previous tutorial as well. The object is quite simple. To display a picture to screen, and to draw boxes in the screen. Next I will show you how to create zones to detect the mouse, to manipulate your programmes. 10 rem set up boxes/zones 20 rem 30 if mode<>0 then mode 0 40 cls back : cls physic 50 DRV=drive : drive=0 60 dir$="\stos\" 70 reserve as screen 6 80 load "pic.pi1",6 90 dir$="A:\" 100 get palette (6) 110 screen copy 6 to back :screen copy 6 to physic 120 drive=DRV 130 rem 140 rem draw boxes 150 rem 160 rem 170 X=0 : Y=Y 180 X1=X : X2=X1+60 190 Y1=Y : Y2=Y1+60 200 for F=1 to 8 210 box X1,Y1 to X2,Y2 220 X1=X2+10 : X2=X1+60 230 if X1>=260 then X1=X : X2=X1+60 : Y1=Y2+10 : Y2=Y1+60 240 next F 250 locate 0,16 260 print "press a key" 270 wait key Once you can understand what I have done so far, then you are almost ready to start your own programmes in earnest. I know that some of you will have wrote simple guess the word type games. Well this is how to use the mouse to select options for your games, or it will be by the next tutorial. The only thing that you need to add to this, is how to save the screen to a bank and then save the everything to disk. I will cover that in a the next tutorial if you are not sure about it. The reason for this is to create active zones within the screen to control your games. i.e. start; high score table; set up control method etc... But as I say, that is for later, when I will also be touching upon the Sprite Editor. lines: 10 rem Set up boxes/zones 20 rem Tell you what the programme does. Although in this case the zones have not been activated, so are really just boxes. lines: 30 if mode<>0 then mode 0 40 cls back : cls physic Set up the screen. You can actually just use one (CLS) command, here instead of clearing the Physical and Back Ground screens. lines: 50 DRV=drive : drive=0 60 dir$="\stos\" Stores the current drive value in the variable (DRV) and then sets up where the picture is to be found on disk. It must be on drive (A:) and within the (STOS) folder. lines: 70 reserve as screen 6 80 load "pic.pi1",6 90 dir$="A:\" Reserves a temporary screen at bank 6, and then loads the picture into the bank. Then it returns you to the root directory of the disk. i.e. not in any folders. lines: 100 get palette (6) 110 screen copy 6 to back :screen copy 6 to physic 120 drive=DRV Reads the colours of the picture in bank 6 (in this case) and then uses them to replace the default colours in Stos. i.e .the start up colours. lines: 130 rem 140 rem draw boxes 150 rem 160 rem Shows you that this is a small sub-routine within the main programme, and tells you what it should do. lines: 170 X=0 : Y=Y 180 X1=X : X2=X1+60 190 Y1=Y : Y2=Y1+60 Contain the data needed to draw the boxes. i.e size and placement on the screen. Done like this it is much easier to move the boxes around. For instance if you wanted 12 boxes instead of the 8 that this draws, then you would just need to change the values of (X1; X2; Y1; Y2) to the new size. And then change the following command from 8 to 12. Ideally, (X1=X) is not a good idea, as (X) is being used as the start location and the size of the boxes as well. So if you are not careful, you could lose control of what the programme is doing, so I will change this bit in lesson 4. However, I am trying to keep things simple here. But as a rule of thumb, you should avoid using the same variable for more than one function. Create a new variable for each function, until you become a better programmer in Stos. lines: 200 for F=1 to 8 210 box X1,Y1 to X2,Y2 220 X1=X2+10 : X2=X1+60 230 if X1>=260 then X1=X :X2=X1+60 : Y1=Y2+10 :Y2=Y1+60 240 next F Contain the commands for how many boxes, where to start drawing them, and how many per row. In this case it is determined by how many can fit onto a row. So if you change the size of the boxes, then that might alter how many fit on each row. lines: 250 locate 0,16 260 print "press a key" 270 wait key Prints a message to screen, telling you that the computer is waiting for a keypress, then waits for that key to be pressed. In this case any key would do, but you can define a specific key if you wanted to add a few more lines of code. Now I will show you how I would code this bit of the programme. I have altered it very slightly from the previous one. But it is basically the same. LESSON 4: 10 rem Draw a box onto the screen 20 rem then use same co-ords to 30 rem create a zone under the box. 40 rem 50 rem set up the screen 60 rem 70 if mode=1 then mode 0 80 cls : key off : hide on : curs off 90 drive=0 : dir$="\stos\" 100 reserve as screen 5 110 load "pic.pi1",5 120 get palette (5) 130 screen copy 5 to physic : screen copy 5 to back 140 dir$="A:" 150 rem 160 rem set up the position & 170 rem size of the box & zone. 180 rem 190 X=0 : Y=0 : SIZE=60 200 X1=X : X2=X1+SIZE 210 Y1=Y : Y2=Y1+SIZE 220 rem 230 rem Draw box and zone 240 rem 250 reset zone 260 for F=1 to 4 270 box X1,Y1 to X2,Y2 280 set zone F,X1,Y1 to X2,Y2 290 X1=X2+10 : X2=X1+SIZE 300 next F 310 rem 320 locate 0,15 : pen 2 : print "PRESS A MOUSE KEY TO PLAY" 330 locate 0,22 : pen 2 : print "CONTROL C TO QUIT" 340 rem set up zone detection 350 rem 360 MX1=X : MX2=X2 370 MY1=Y : MY2=Y2 380 if MX2>=320 then MX2=319 390 limit mouse MX1,MY1 to MX2,MY2 400 show on 410 MK=0 420 repeat 430 MK=mouse key 440 until MK<>0 450 BUTTUN=zone(0) 460 locate 0,12 : print "YOU ARE IN ZONE";BUTTUN 470 wait 100 480 locate 0,12 : print " " 490 goto 410 500 rem reset the screen for editing 510 rem 520 curs on : show on : limit mouse : pen 1 And now what it does and why. The first thing that you will notice, is that I have used quite a lot of (REMs) to explain what I have done. I find, that if I do not use lots of them, then when I come back to the programme after a couple of weeks, that I can not understand what it was created to do, and how I managed to get things to work. Lines: 10 rem Draw a box onto the screen 20 rem then use same co-ords to 30 rem create a zone under the box. Are the main title, or what the main programme is about. In an actual programme I would use equal signs or plus/minus signs to highlight the different parts. I will show you what I mean in the next programme. Lines: 40 rem 50 rem set up the screen 60 rem 70 if mode=1 then mode 0 80 cls : key off : hide on : curs off 90 drive=0 : dir$="\stos\" 100 reserve as screen 5 110 load "pic.pi1",5 120 get palette (5) 130 screen copy 5 to physic : screen copy 5 to back 140 dir$="A:" Are the first subroutine. In this case the setting up of the screen resolution and the screen colours etc... and have all been covered before. It finishes by returning the programme back to the root directory of drive (A:). The last line is important. It must be ("A:") and not ("a:"). That means you must use a capital letter, as Stos will not change this for you. If you forget to use a capital, then the line will not work, and you will remain within the (STOS) folder. Lines: 150 rem 160 rem set up the position & 170 rem size of the box & zone. 180 rem Tell you what this subroutine is going to do. Lines: 190 X=0 : Y=0 : SIZE=60 200 X1=X : X2=X1+SIZE 210 Y1=Y : Y2=Y1+SIZE Set up the start location, and size of the boxes. Notice that this time there is a new variable. I called it (size) because it governs the size of the square. If it had not been a square, then I would have needed an extra variable - one for the height and one for the width - but I am keeping things as as simple as I can. Lines: 220 rem 230 rem Draw box and zone 240 rem Inform you that this is where the drawing is to be done. Line: 250 reset zone Clears all the (zones) out of memory, and makes sure that the only (zones) on the screen are those that you are about to create. Lines: 260 for F=1 to 4 270 box X1,Y1 to X2,Y2 280 set zone F,X1,Y1 to X2,Y2 290 X1=X2+10 : X2=X1+SIZE 300 next F Set up the number of boxes. Note that the (Zone) command is the same as the (box) command, except that each zone must have a value, unlike the boxes. Each (Zone) has its own value, so the first zone will be (zone1) because (F=1) the first time. And the other (zones) will number up to 4 in this example, as that is as high a value as (F) takes in this example. Lines: 310 rem 320 locate 0,15 : pen 2 : print "PRESS A MOUSE KEY TO PLAY" 330 locate 0,22 : pen 2 : print "CONTROL C TO QUIT" Print messages to screen to inform you of what is happening, and how to stop the programme. Lines: 340 rem set up zone detection 350 rem Tell you that this is where the (Zones) are detected. Lines: 360 MX1=X : MX2=X2 370 MY1=Y : MY2=Y2 380 if MX2>=320 then MX2=319 390 limit mouse MX1,MY1 to MX2,MY2 400 show on Limit the mouse to the area where the boxes are drawn, and then reveal the mouse on screen. If you are wondering why the mouse moves past the last box, the answer lies in the (MX2=X2) which is wrong. Think back to when we had more than four boxes on the screen, and had to reset (X2) because (X1) was too large. Another clue would be that (F=5) but there are only 4 boxes drawn onto the screen. I will explain it in the last lesson if you have not got it yet. Line: 410 MK=0 Sets the value of the mouse key to zero. This is a variable that I have created to zero the mouse key value. Each mouse key has a value - as does each joystick direction - and by testing the value of the mouse keys, you can test whether a key is being pressed. I always put the value at the start of the routine. It is as well being there as being anywhere else, and will be the point in the programme that is jumped to to retest the mouse keys. Lines: 420 repeat 430 MK=mouse key 440 until MK<>0 Form a loop that will be repeated until something happens. What that something is, is determined by you. In this case it is a mouse key being pressed. So the command means (REPEAT UNTIL MK does not equal zero). Notice that (MK) has already been set to zero in line 410, and now it is being reset to the mouse keys. No mouse key = 0 The left mouse key =1 The right mouse key = 2 Both keys = 3 (1+2=3) Line: 450 BUTTUN=zone(0) Creates a variable for the squares on screen. Remember that they are supposed to be buttons to activate things. And it test for a sprite entering the zone. In this case it is testing for the mouse, and as the mouse is (sprite 0) then this is the value that is tested for, and (buttun) will then hold the value of he zone. If you do not click in a square - zones 1 to 4 - the the value of the zone will be zero. Notice also that the word is not buttOn but buttUn. This is to get around the command word (ON) which would be part of butt(ON), and you are not allowed to use command words in variables. Oddly enough the variable sim(ON) would work, at least it does on my computer. You can tell that something is wrong with your variables when you list them. buttun would list as buttun, however; button would list as butt ON. Or it could be the other way around, depending upon whether commands or variables take capitals in your setup. ie. BUTT on. Lines: 460 locate 0,12 : print "YOU ARE IN ZONE";BUTTUN 470 wait 100 480 locate 0,12 : print " " 490 goto 410 Prints the value of the zone that you are in, waits a short while, and then erases the message by printing a blank message on top. Then it returns to line 410 which resets the variable (MK) back to zero. If it was not reset somewhere, than the (REPEAT UNTIL) loop would fail because (MK) would still hold the value of the mouse key that was pressed. The spaces printed - in line 480 - are two greater than the letters printed - in line 460 - to allow for the value of buttun to also be erased. It should be one figure and one space away from the message, thus two extra spaces are needed. Lines: 500 rem reset the screen for editing 510 rem 520 curs on : show on : limit mouse : pen 1 Would reset the screen, but in this programme they are never acted upon, because the only escape is via the break key. I will change it slightly now to show you how to set up a series of choises. This is basically the same programme, but I have altered certain lines to improve the programme a bit. Notice the way that I have highlighted the (REM) statements, and used different ways for different parts of the programme. LESSON 5 10 rem ======================================= 20 rem ======================================= 30 rem === Draw a box onto the screen === 40 rem === then use same co-ords to === 50 rem === create a zone under the box. === 60 rem ======================================= 70 rem ======================================= 80 rem 90 rem ---- store screen res and drive ---- 100 rem 110 MD=mode 120 DRV=drive 130 rem 140 rem ---- set up the screen ---- 150 rem 160 if mode=1 then mode 0 170 cls : key off : hide on : curs off 180 drive=0 : dir$="\stos\" 190 reserve as screen 5 200 load "pic.pi1",5 210 get palette (5) 220 screen copy 5 to physic : screen copy 5 to back 230 dir$="a:" 240 rem 250 rem ---- set up the position & ---- 260 rem ---- size of the box & zone. ---- 270 rem 280 X=0 : Y=0 : SIZEH=60 : SIZEV=30 290 X1=X : X2=X1+SIZEH 300 Y1=Y : Y2=Y1+SIZEV 310 rem 320 rem ++++ Draw box and zone ++++ 330 rem 340 reset zone 350 for F=1 to 4 360 box X1,Y1 to X2,Y2 370 set zone F,X1,Y1 to X2,Y2 380 X1=X2+10 : X2=X1+SIZEH 390 next F 400 rem 410 rem ++++ SCREEN MESSAGE +++++ 420 rem 430 locate 0,15 : pen 4 : print "PRESS LEFT KEY TO PLAY" 440 locate 0,22 : pen 4 : print "PRESS RIGHT KEY TO QUIT" 450 rem 460 rem ---- set up zone detection ---- 470 rem 480 rem 490 rem ++++ limit mouse to zones ++++ 500 rem 510 MX1=X : MX2=X1-10 520 MY1=Y : MY2=Y2 530 rem 540 limit mouse MX1,MY1 to MX2,MY2 550 show on 560 rem 570 rem ---- detect mouse key ---- 580 rem 590 MK=0 600 repeat 610 MK=mouse key 620 until MK<>0 630 rem 640 rem ++++ test for not key one ++++ 650 rem 660 if MK<>1 then goto 780 670 rem 680 rem ++++ only if key one ++++ 690 rem 700 BUTTUN=zone(0) 710 locate 0,12 : print "YOU ARE IN ZONE";BUTTUN 720 wait 100 730 locate 0,12 : print " " 740 goto 590 750 rem 760 rem ---- reset the screen for editing ---- 770 rem 780 curs on : show on : limit mouse : pen 1 : mode MD : drive=DRV This is the final lesson of this tutorial, so I have included everything that we have been going over so far. And if you are wondering, I do indeed use this many (REMS) when I programme. OK it takes a couple of hours to remove them - if you want to - when the programme is finished, but it saves hours upon hours of wondering how I achieved something. Lines: 10 rem ======================================= 20 rem ======================================= 30 rem === Draw a box onto the screen === 40 rem === then use same co-ords to === 50 rem === create a zone under the box. === 60 rem ======================================= 70 rem ======================================= Are the title, and everything should have a title. I use the (=) because it stands out. I then use the (-) for each sub routine, and the (+) for each part of that subroutine. The upshot is, that in a programme several 100 lines long, can be listed and stopped at the right spot. Lines: 80 rem 90 rem ---- store screen res and drive ---- 100 rem 110 MD=mode 120 DRV=drive Are somewhat new. I have included a variable to store both the drive and the screen resolution. The screen resolution is the most important, as most things run in low resolution, but are easier read from medium resolution. So I edit in medium, but run in low resolution. Lines: 130 rem 140 rem ---- set up the screen ---- 150 rem 160 if mode=1 then mode 0 170 cls : key off : hide on : curs off 180 drive=0 : dir$="\stos\" 190 reserve as screen 5 200 load "pic.pi1",5 210 get palette (5) 220 screen copy 5 to physic : screen copy 5 to back 230 dir$="A:" Have not been changed. They just set up a screen bank after checking on screen resolution etc.. and then get picture and store it in bank 5. Then it returns the programme back to the root directory of drive (A:). Lines: 240 rem 250 rem ---- set up the position & ---- 260 rem ---- size of the box & zone. ---- 270 rem 280 X=0 : Y=0 : SIZEH=60 : SIZEV=30 290 X1=X : X2=X1+SIZEH 300 Y1=Y : Y2=Y1+SIZEV Set up the size and location of the first box. Notice that this time the boxes are not square. As a result I have had to include a variable for both the height and width. In this case I have just tagged a (V) for vertical and (H) for horizontal onto the old variable. So (SIZEH) means size horizontal. There is no particular reason for the box sizes, other than to be large enough to hold something, but small enough to fit nicely onto the screen. Lines: 310 rem 320 rem ++++ Draw box and zone ++++ 330 rem Tell you what is going to happen. Notice that I have used (+) to show that it is still part of the setting up of boxes subroutine. Line: 340 reset zone Resets all zones. It removes all zones in fact. You need to include this to control the number and place of the zones. In this example it does not matter, because there is only the one set of zones being created. But if you create others later on, you need a way of turning the old zones off. Lines: 350 for F=1 to 4 360 box X1,Y1 to X2,Y2 370 set zone F,X1,Y1 to X2,Y2 380 X1=X2+10 : X2=X1+SIZEH 390 next F Draw the boxes and zones to screen. Notice that all I needed to change here was the variable (SIZE) to (SIZEH) even though the boxes are not the same height as those drawn previously. Lines: 400 rem 410 rem ++++ SCREEN MESSAGE +++++ 420 rem 430 locate 0,15 : pen 4 : print "PRESS LEFT KEY TO PLAY" 440 locate 0,22 : pen 4 : print "PRESS RIGHT KEY TO QUIT" Show the new messages. Notice that I have changed the (PEN) colour to avoid flashing when the cursor is reactivated. Notice also that the left mouse key will activate the programme, whilst the right one will now quit back to the screen. Actually, pressing both keys will also quit. Lines: 450 rem 460 rem ---- set up zone detection ---- 470 rem 480 rem The start of a new subroutine, is shown by(-). Lines: 490 rem ++++ limit mouse to zones ++++ 500 rem 510 MX1=X : MX2=X1-10 520 MY1=Y : MY2=Y2 530 rem 540 limit mouse MX1,MY1 to MX2,MY2 550 show on I have changed the (MX2) bit and have removed the test for the mouse moving off of the screen in the (LIMIT MOUSE) command. The reason the mouse moved too far to the left was because the (X1) command was read 5 times, but only used 4 times, so was now holding the location of the start of the 5th box. The reason for subtracting 10 from (X1) in (MX2=X1-10) is because that is the spacing provided earlier (line 380 X1 =X2-10), so if you take 10 from (X1) you have location of the end of the last box. This could also have been done by subtracting the value of (SIZEH) plus 10 from (X2) ie (MX2 = X2-(SIZEH+10)). So you take (60+10=70) and subtract it from (X2). Lines: 560 rem 570 rem ---- detect mouse key ---- 580 rem 590 MK=0 600 repeat 610 MK=mouse key 620 until MK<>0 Detecting the mouse key, and no changes have been made. (MK) which will hold the value of the mouse key is reset to zero, which means no key has been pressed when the (REPEAT UNTIL) command is tested. Lines: 630 rem 640 rem ++++ test for not key one ++++ 650 rem 660 if MK<>1 then goto 780 Are new, and test to see if (MK=1). If it does then this line is ignored. However, if you pressed either the right key or both of them then (MK) will not equal 1 , in this case the programme will jump to line 780. Remember that the programme loops until a mouse key is pressed, so you do not have to check for zero. Lines: 670 rem 680 rem ++++ only if key one ++++ 690 rem 700 BUTTUN=zone(0) 710 locate 0,12 : print "YOU ARE IN ZONE";BUTTUN 720 wait 100 730 locate 0,12 : print " " 740 goto 590 Are not changed, and print a message telling you which zone the mouse was in when you pressed the mouse key. Lines: 750 rem 760 rem ---- reset the screen for editing ---- 770 rem 780 curs on : show on : limit mouse : pen 1 : mode MD : drive=DRV End the programme and reset the screen for editing. I did not include a variable to reset the screen colours, as you could do that yourself. But that, as they say, is that. And is more than enough for now. Next time I intend to cover the different screens, and touch upon the Sprite Editor, and how to use it to make sprites that can be used with the Zone command to control your programmes.