'From http://www.qbasic.com 'By Kris Parker DECLARE SUB text (x, y, characterz, bottom, sentence$) DECLARE SUB StoryBox () DECLARE SUB ClearBox (WhichBox$) SCREEN 13 CALL text(1, 1, 40, 26, " Ok here is a stupid little text program that allows the programmer to easily type a sentence without having to worry about character spacing!! ") CLS CALL text(1, 1, 40, 26, " As you will notice this program will take care of that problem for you by reading ahead of the string and knowing where to start a new line without cutting off a word! ") CLS CALL text(1, 1, 40, 26, " Now at first this might seem trivial, and it is, but I have included for your use a small story box and the coordinates that you need to display these sentences in a nifty little text box... here it is! ") CLS StoryBox CALL text(18, 8, 26, 23, " Here is that story box I was telling you about, and you can make your text fit in any place on the screen, just give it the correct coordinates and let it do the work! ") CALL text(18, 8, 26, 23, " A couple things to tell you before you start... ") CALL text(18, 8, 26, 23, " You can change the text color within the Text sub also more detailed instructions on how to use this program and how it works can be found within the subs inluded with WordWrap ") CALL text(18, 8, 26, 23, " Ok enough, enjoy this program, and thank you for downloading it. ") CALL text(18, 8, 26, 23, " (C) 1998 Kris Parker Email: snowmankp@hotmail.com ") 'Copyright 1998 Kris Parker 'This clears out either the stats box or story box depending on programmers call 'To Call ClearBox type the following: 'CALL ClearBox ("StoryBox") <--- This Clears StoryBox, CALL ClearBox ("StatsBox") <---This Clears StatsBox 'Dont mess with anything in this sub! SUB ClearBox (WhichBox$) IF WhichBox$ = "StoryBox" THEN LINE (52, 132)-(267, 188), 256, BF IF WhichBox$ = "StatsBox" THEN LINE (202, 12)-(298, 118), 256, BF END SUB DEFINT A-Z 'Copyright 1998 Kris Parker 'Similar to the StatsBox but this creates the box Text sub writes to 'Again dont mess with this SUB StoryBox LINE (50, 130)-(269, 190), 45, B LINE (51, 131)-(268, 189), 32, B LINE (52, 132)-(267, 188), 256, BF END SUB DEFSNG A-Z 'Copyright 1998 Kris Parker AKA TDC_Snowman 'Email: snowmankp@hotmail.com ' 'begin---This variable is used to determine the starting point for your "PRINT MID$()" 'times---This variable is used to count the amout of times the "If ascum=32" runs. 'CountTest----This variable is used to determine where (in characters) you are in the string sentence$. 'EndingChar---This variable is assigned the value of one less then CountTest, it is used with ascum to determin the ASCII code for the last character in the given string expression 'Length---This variable is assigned the total Length in characters of the string sentence$ 'Characters--This variable starts at 26 and is reassigned as needed to be the amount of characters printed from "begin" in a PRINT MID$() 'To call TEXT type the following: 'CALL Text(location of x coordinate, location of y coordinate, amount of characters to allow, bottom of text area, " the sentence or paragraph you want to display " ) 'For this program generally we use 18 for x, 8 for y, 26 for characterz, and 23 for bottom. These values are used to fill text box. ' 'YOU DO NOT NEED TO CHANGE ANYTHING BEYOND THIS POINT '----------------------------------------------------------------------------------------------- SUB text (x, y, characterz, bottom, sentence$) Top = x begin = 1 times = 1 CountTest = characterz EndingChar = (characterz - 1) Length = LEN(sentence$) COLOR 10 CALL ClearBox("StoryBox") FOR counts = 1 TO (LEN(sentence$) + 1) IF counts = Length THEN EndingChar = (Length - 1): Characters = (Length - begin) IF counts = CountTest THEN Characters = characterz DO ascum = ASC(MID$(sentence$, EndingChar, 1)) IF ascum <> 32 THEN CountTest = (CountTest - 1) EndingChar = (EndingChar - 1) Characters = (Characters - 1) END IF LOOP UNTIL ascum = 32 IF x > bottom THEN SLEEP LINE (52, 132)-(267, 188), 256, BF x = Top END IF IF ascum = 32 THEN SLEEP 1 LOCATE x, y IF times = 1 THEN Characters = (Characters - 1) PRINT MID$(sentence$, begin, Characters) begin = EndingChar CountTest = (CountTest + characterz) EndingChar = (CountTest - 1) x = (x + 1) times = (times + 1) END IF END IF NEXT counts IF x > bottom THEN SLEEP LINE (52, 132)-(267, 188), 256, BF x = Top END IF SLEEP 1 LOCATE x, y PRINT MID$(sentence$, begin, Characters) SLEEP END SUB