Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [DBP] Printing Large Blocks of Text (Recursive)

Author
Message
Jeff032
17
Years of Service
User Offline
Joined: 13th Aug 2007
Location:
Posted: 16th Aug 2007 02:15
This function will split up and print a long string so that it fits within a box of a given width. It uses 3 helper functions, but they could be merged in if you feel like it.

This function is recursive, meaning that it will call itself. It can also be somewhat slow, so if anyone has a faster method, feel free to post it.

In order to make the small speed problem less noticable, the function calls itself before printing, meaning that it will work out all the logic first, and then print all the lines in reverse from the bottom up, very quickly.

Usage:
printMulti(string$, x, y, width, spacing)

string$ is the string you wish to print
x is the x position of the lines
y is the y position of the first line
width is the width of the box to fit the text in
spacing is the vertical spacing between lines



Enjoy

-Jeff

Space Game WIP
Eevil Weevil
17
Years of Service
User Offline
Joined: 1st Aug 2007
Location: Wherever you are, I wil follow
Posted: 27th Aug 2007 22:38
yay

Hi ppl!
Erm...

Login to post a reply

Server time is: 2024-11-22 19:11:38
Your offset time is: 2024-11-22 19:11:38