Self by Uncle Sam4th Aug 2006 23:20
|
---|
Summary Prints specified text onto the screen like it is being typed by a person. Description Prints specified text onto the screen like it is being typed by a person. Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com PrintText("Look at this lovely function. It has a delay time of 40 milliseconds, which is perfect, and the line wraps after about 50 characters. Note that if you set the length to 50, it will first print 50 characters, and then start looking for the end of a word so it can wrap, so if you want it to be about 50 characters, set it to 45.",40,50) wait key end function PrintText(text$,waittime,linelength) origtext$=text$ NewLine: text$=left$(origtext$,1) origtext$=right$(origtext$,len(origtext$)-1) rem print each letter on one line counter=1 repeat print text$; text$=left$(origtext$,1) origtext$=right$(origtext$,len(origtext$)-1) inc counter wait waittime if counter=linelength if text$<>" " goto FindBlank else counter=1 text$=left$(origtext$,1) origtext$=right$(origtext$,len(origtext$)-1) print " " endif endif until len(origtext$)=1 goto FinishedTyping rem search for blank FindBlank: repeat print text$; rem see if out of text if len(origtext$)=1 then goto FinishedTyping text$=left$(origtext$,1) origtext$=right$(origtext$,len(origtext$)-1) wait waittime rem if out of room if len(origtext$)=1 then goto FinishedTyping until text$=" " if len(origtext$)>1 print " " goto NewLine else goto FinishedTyping endif FinishedTyping: print text$ + origtext$ endfunction |