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.

Newcomers DBPro Corner / Need help with a function to process text and print it

Author
Message
Soldier X1
18
Years of Service
User Offline
Joined: 10th Oct 2005
Location:
Posted: 7th Aug 2007 21:36
Ok the piece of code I need help with is below. Now what I was tring to do was write a function that would take a large paragraph and print out sentences about 65 charectors long without me going and making seperate print statements for each one. However after I got it working I realized that it doesn't take in account that it sometimes splits words between sentences, so... I decided to fix it but instead I have messed it up a bit and got lost. I would appreciate any help or tips. Thanks.

Zergei
19
Years of Service
User Offline
Joined: 9th Feb 2005
Location: Everywhere
Posted: 8th Aug 2007 02:57 Edited at: 8th Aug 2007 02:58
Did some work on it, trying not to midify the structure you've used. So far it worked for me, so try it out.



Further on my stuff at...
TurboSquid.com
The3dStudio.com
Soldier X1
18
Years of Service
User Offline
Joined: 10th Oct 2005
Location:
Posted: 8th Aug 2007 05:07
Oh thanks a million! I was ready to rewrite the thing, works great!
Dazzag
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Cyprus
Posted: 8th Aug 2007 16:39
I did something similar for the text adventure contest. If I was you though look into the command "text width" to work out where to split. I basically use text width to work out where the sentence will stop when it hits my margin (end of screen normally) then go backwards to find a space (remember to handle it if there is no space; just a really long word). Annoying with DBP's rubbish text commands, but fairly straight forward.

Cheers

I am 99% probably lying in bed right now... so don't blame me for crappy typing
Current fave quote : "She was like a candle in the wind.... unreliable...."

Login to post a reply

Server time is: 2024-09-27 02:29:19
Your offset time is: 2024-09-27 02:29:19