===========================Tutorial #1======================== = = =SMInternational 2002 (TM) = =(C) Sameer Mirza 2002 = =Email: dark_soul279@hotmail.com = ============================================================== ************************************************************** Unauthurized reproduction of this File is Illegal unless, Nothing is edited, and all credit is given to Sameer Mirza ************************************************************** Qbasic 4.5 / Qbasic 1.1 Ok welcome to my first tutorial... This this Tutorial we will cover the following commands: ~~~~~~~~~~~~~~~~~~~~~~~ CLS SCREEN PRINT COLOR END SYSTEM LOCATE PRESET ~~~~~~~~~~~~~~~~~~~~~~~ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ IF you DO-NOT-UNDERSTAND SOMETHING EMAIL ME!! IF YOU ARE CONFUSED EMAIL ME!! ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ First lets look at the SCREEN command: The screen command sets the graphics mode. now your thinking graphics mode? what the !@#$!!? Your monitor (computer screen) has a resolution A resolution is the number of pixels (in total) (A PIXEL IS A TINY WINY LITTLE DOT) You can change this resolution.... Each SCREEN MODE has a different type of screen resolution There is one Screen Mode that is TEXT ONLY meaning that you can only display text...NO GRAPHICS Which is a -no no- for games. To make a game look more real, the programmer increases its resolution through programming... The default screen mode for any dos program is TEXT ONLY So in every program we have to tell the computer to change the screen mode How do we do that??? We do it using the SCREEN command... Here is a list of SCREEN mode numbers (in qbasic) I didn't write all because the rest are not important cause they suck.... ----------------------------------- SCREEN 0 (Text Only) SCREEN 12 (640 X 480 X 16) SCREEN 13 (320 X 200 x 256) ----------------------------------- Now you look at those numbers and think whaaaaa? --- 640 is the TOTAL number of HORIZONTAL PIXELS in SCREEN MODE 12 480 is the TOTAL number of VERTICAL PIXELS in SCREEN MODE 12 16 is the number of COLORS for that screen mode --- --- 320 is the TOTAL number of HORIZONTAL PIXELS in SCREEN MODE 13 200 is the TOTAL number of VERTICAL PIXELS in SCREEN MODE 13 256 is the number of COLORS for that screen mode --- I will cover SCREEN 12 and SCREEN 13 in the next tutorial.... First lets look at SCREEN 0 which is the TEXT ONLY SCREEN MODE To set the Monitor to TEXT ONLY mode we do the following.... SCREEN 0 thats it! a simple SCREEN 0 and your in text only! Now sometimes people have cheap monitors and they FLICKER (put extra pixels all over the place) when they change screen modes. Soooo always good to put the CLS command after the SCREEN command CLS? well CLS simply CLEARS THE SCREEN sooo SCREEN 0 CLS ------------------------------------------------------------- ok now we have the monitor at TEXT ONLY and have a clear spotless screen.... but its black.... What if we want to write something on the screen?? this is were is the PRINT command comes in handy the PRINT command PRINTS TEXT ON THE SCREEN (no not on the printer) if you wanted to print HELLO WORLD! on the monitor you would do the following: PRINT "HELLO WORLD!" lets put everything we know so far together.... SCREEN 0 CLS PRINT "HELLO WORLD!" type this into qbasic and press F5, the program runs and displays HELLO WORLD! in the top left hand corner of the screen... what if we didn't want it to print stuff on the LEFT HAND CORNER of the screen?? Well this is were the LOCATE command comes in handy. LOCATE tells the computer to print text in certain places to use the LOCATE command properly you have to tell the computer two things (1) the ROW # (2) the Column # So, to print text in the middle of the screen we would do the following.... oh yeah the middle of the screen's co-ordiantes are ROW 11 COLUMN 15 so we do this LOCATE 11, 15 TADA! lets put it together SCREEN 0 CLS LOCATE 11, 15 PRINT "HELLO WORLD!" As you can see we put the locate BEFORE the PRINT COMMAND because we have to tell the computer where to put the text BEFORE printing the TEXT... (DUH!) Also don't you think it looks pretty dull? Lets change its color.... To change TEXT COLOR we use the COLOR command Now this is a a little confusing.... So I'll make it easy Qbasic has 0 to 15 COLOR CODES for example the COLOR CODE for BLUE is 9 so to print BLUE text in the middle of the screen you do this.... LOCATE 11,15 COLOR 9 PRINT "HELLO WORLD!" and if you put it all together you get this: SCREEN 0 CLS LOCATE 11, 15 COLOR 9 PRINT "HELLO WORLD!"