Ahem... In a language he understands...
BECAUSE TYPING IN ALL CAPS MEANS YOU ARE SHOUTING HOLLERING AND SCREAMING AT THE PERSON READING YOUR POST AND REALLY HURTS AND POKES OUR EYES OUT TO HAVE TO READ WHAT YOU POSTED SO IT MAKES THE LESS TOLERANT PEOPLE NOT WANT TO HELP YOU AND THUS THEY GET REALLY MAD AT YOUR GODAWFUL MANNERS SO THE NICER PEOPLE TRY TO SAY IN A NICE WAY THAT YOU SHOULD NOT TYPE IN ALL CAPS BUT INSTEAD YOU BECOME A STUBBORN LITTLE SQUIRREL AND CONTINUE TYPING IN ALL CAPS AND YOU DONT EVEN HAVE PROPER PUNCTUATION LIKE PERIODS AND COMMAS SO I ASSUMED THAT IF I TYPE THE SAME WAY YOU DO YOU WILL UNDERSTAND WHY WE DONT WANT TO SEE PEOPLE TYPING IN ALL CAPS LETTERS
Okay, returning to default language.
1. The Help file is a reference. You use it when you need to learn more about a specific command, etc. It shows you the parameters of the command (if thera are any), gives a good description about the command, and even has examples for each of them. It's a handy reference, but to make a game or program you have to use what you learned from the help file. Use it only as a guide. Basic copy-pasting of code seems to be the only option when you have only started programming, but later on you would have to try out new methods that will better suit your coding style and preference. You can learn a lot from the help file alone.
About restoring the screen - Yes, that is an infinite loop. The help file was assuming that you already know how to quit your program and return to the editor by pressing F12. While you are still working on your program, pressing the Escape key will bring up the CLI (Command Line Interface, or you can just call it a console, like in some video games), so if you were in an infinite loop, the only way to exit would be to press F12. When the game has been compiled, however, pressing F12 will not do anything, but pressing Escape will quit your program. The problem is, if you disabled the escape key, there would be no way out of your program. A quick way to fix that is to insert the following code right after the ENDIF (Click this white button):
if escapekey() =1 then end
About the 99 display modes - Change these 3 lines:
INPUT AD$
IF ASC(AD$)>48
position=ASC(AD$)-48
into simply:
Now to explain the number 48. Apparently, the number 48 is the ASCII value of the keyboard character "0" (The zero character. Treat it as a string, not as a number.). Notice how the original code used inkey$() to return what keyboard character was pressed. The problem is, inkey$() returns a string, but we needed an integer value to assign to the variable position. To solve the problem, they came up with a very crude way of getting a keyboard character and turning it into a number. What it does is convert the string returned by inkey$() into a useable integer with the ASC() function. What ASC() does is return the ASCII value of a single character string, and since the ASCII value is an integer, it is just what the code needs and is something that we can use.
First, take a look at the IF statement. If you don't press any button, inkey$() returns a 0 right? So it ignores the code until the ENDIF and loops again so it can wait for another possible keyboard press. Now, in the checklist that it displays, the possible display modes printed out are preceded by a number , which is the value of the variable T in the FOR-NEXT loop. Since the counting starts at 1, it would be senseless to wait for the keyboard press "0" because it is not one of the choices. However, looking at my ASCII reference (In my QBASIC book), if "0" has ASCII value of 48, "1" is 49, "2" is 50, "3" is 51, "4" is 52, and so on until "9" which is 57. All the other characters have their own ASCII values, including both uppercase and lowercase letters, and other special characters, including the "wierd" ones that you get by holding ALT and pressing a number combination in the numeric keypad on your keyboard (Try this: Open notepad or Word and hold ALT and press the characters "4" then "8" in your keypad. What comes out is a "0" right? Basically, if you hold alt then follow it up with the ASCII value of a character, that character shows up, even if it's not a character on your keyboard. Try ALT then 164. You should see a "ñ" which is not on your keyboard. Cool right?).
So, when you push a character, inkey$() returns that character as a string, like if you pressed "0" inkey$() returns a "0". Then ASC() does it's job and gives you the ASCII value of "0" which is 48. Now, we subtract 48 from that number because we want to "offset" the number into something more understandable. So if you pressed "1" and got a 49, subtract 48 from that and you get the number 1, which to the program means that you chose selection number 1. Then you could have 2, 3, 4, and so on. It was comparing it to 48 so that it could avoid the 0, which is a non-existent choice in the program.
However, what happens when you go over "9"? ALT+58 says the next should be ":" so if you wanted to choose selection number 10, you would have to press the ":" key (You have to hold the Shift button). The ASCII value of ":" which is 58, minus 48, is 10. So to get eleven you would need to press ";" and so on. Not very appealing right? That is why you could replace it with an INPUT statement instead, like in the previous question.
Remember, if the variable name ends with a $, like AD$, it is a string, or a set of characters. However, if it doesn't end with a $, it is an integer. Integers are your ordinary "counting numbers" and can be either positive or negative. If it ends with a #, that is a floating point variable. These variables are intended to hold precise values like numbers with decimal values, such as 1.124125345 and can be either positive or negative. The problem with it though is you may experience very small inaccuracies with them (This is just a computer after all, and has very limited memory). So if in your INPUT statement you want the person to type the ASCII value + 48 equivalent of their choice, then be my guest and use INPUT AD$. However, if you want to make it easier and just input the exact number of their choice instead, then use INPUT AD. That way, if you want choice 10 then you just type "10" rather than typing ":".