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 / Word wrap for RPG text boxes

Author
Message
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 27th Aug 2005 14:56 Edited at: 27th Aug 2005 14:58
After doing a word wrap function, I got to thinking. Would it really be that hard to have words wrapped without breaking them up? Not at all.

There is a bug. Seems to hault with a box width less than 80. That number is probably different depending on the words in the strings.
So take your longest word "n" and make sure your width can accomodate a width of n+1.

So instead of:


You'd have:





Your signature has been erased by a mod because it's larger than 600x120...
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 28th Aug 2005 01:28
Not DBC compatible!

TDK_Man

xtom
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Ireland
Posted: 28th Aug 2005 01:34
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 28th Aug 2005 03:01
Quote: "Not DBC compatible!"


Update! Get with the times man!

Your signature has been erased by a mod because it's larger than 600x120...
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 28th Aug 2005 20:19
He's saying that for the DBC users. He posted a thread with the request that everyone should state the language that is used. We -DBC users- have to test every single code snippet to see if the code works, so it'll save us a lot of time.

Immunity and Annihalation makes Immunihalation...
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 29th Aug 2005 20:54
And I'm saying to all those DBC users to update and get Pro!

Really, the only command that isn't DBC compatible is the text width() function. You can write your own function to estimate it.



Your signature has been erased by a mod because it's larger than 600x120...
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 30th Aug 2005 15:03
I have DBP and DBC.

Phaelax,

Not all people have the money to buy DarkBasic Pro. Some of them may not even earn money because they're too young.
Besides, don't be so negatif about DBC.

Second of all,
text width() IS compatible with DBC. It's those commands as string or as integer, etc... or types that we cannot use.

Immunity and Annihalation makes Immunihalation...
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 30th Aug 2005 18:49
lol, thats it? so get rid of them.
And is there a reason you're attacking all my posts lately?

Here, DBC compatible code for those that can't take the whole 2 seconds it took to change the DBP code.


Your signature has been erased by a mod because it's larger than 600x120...
NanoBrain
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 31st Aug 2005 09:32
Phaelax,

I don't attack posts, but I will yours! Get off your "throne".


+NanoBrain+
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 1st Sep 2005 16:50
What throne? I write a simple snippet and every gets on me about not adding compatibility for something I don't use, but would take less than a minute for anyone else to change? piss off

Your signature has been erased by a mod because it's larger than 600x120...
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 1st Sep 2005 17:52
Quote: "Update! Get with the times man!"


Quote: "lol, thats it? so get rid of them."


Quote: "And I'm saying to all those DBC users to update and get Pro!"


Quote: "Here, DBC compatible code for those that can't take the whole 2 seconds it took to change the DBP code."


Quote: "piss off"


This doesn't sound very friendly of you either.

Quote: "I write a simple snippet and every gets on me about not adding compatibility for something I don't use, but would take less than a minute for anyone else to change?"


This is not the reason why we are picking on you.
TDK is DBC-friendly and tells the DBC users that it doesn't work for DBC. YOU started with saying that DBC-users should all buy DBP.

Stop looking down on DBC-users!
Get off your "throne"!
It's the same.

Immunity and Annihalation makes Immunihalation...
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 1st Sep 2005 23:33 Edited at: 1st Sep 2005 23:53
Quote: "Update! Get with the times man!"

ever heard of a joke? And telling people to update is hardly a negative comment.

Notice how TDK took no offense but you jump right in. If you must test every snippet to see if it works in classic, then its your problem. The pro users aren't obligated to write anything classic compatible. This is suppose to be an open forum were ppl write code for whatever they feel like. Don't like the code, then shut up and move on.

How bout we just let this go and forget about it, ok

Your signature has been erased by a mod because it's larger than 600x120...
NanoBrain
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 2nd Sep 2005 03:59
Phaelax,

This has been blown out of proportion, partly due to my last comment. May you forgive me that I did not agree with dogging DBC users, if so-be that was what you were doing. If possible, I will take back what I have stated earlier.

Thank you for the code snippet, because it will be of much use to me, and I am sure, many others as well.


+NanoBrain+
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 2nd Sep 2005 07:03
I wasn't dogging DBC users, it was intended as a joke. It's like me telling someone with a 2 week old computer that they're out dated.

Your signature has been erased by a mod because it's larger than 600x120...
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 2nd Sep 2005 20:03
Uhm... Truce?

Immunity and Annihalation makes Immunihalation...
kRx
19
Years of Service
User Offline
Joined: 2nd Apr 2005
Location: Canterbury, Kent, UK
Posted: 3rd Sep 2005 02:56
LOL nice argument guys

kR
NanoBrain
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 3rd Sep 2005 06:30
Phaelax,

Sorry that your jokes were taken seriously. As said by Sven B, truce?



+NanoBrain+
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 3rd Sep 2005 07:50
truce

Your signature has been erased by a mod because it's larger than 600x120...
harggood
21
Years of Service
User Offline
Joined: 9th Apr 2003
Location: the forest
Posted: 4th Sep 2005 20:14
very nice thanks Phaelax

Awfuldark Forest
Xenocythe
18
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 5th Sep 2005 01:18
WHAT? WHAT? NO TRUCE! WAR!

ehh, sorry.
Underworld 1020
20
Years of Service
User Offline
Joined: 2nd Mar 2004
Location: NY, USA
Posted: 6th Sep 2005 03:43
Nice code, I'm going to have to study it and see how it was done, good job

WarGoat
19
Years of Service
User Offline
Joined: 19th Sep 2004
Location: Montreal
Posted: 8th Sep 2005 04:06
hey it was quite cool (and the text was funny ) can you add a function to do like the text is writing letters by letters? like that i could more understand things of rpg box system.

Windows XP,pentium IIII, 1,9 MGZ, 256 mb memory, 128 mb video card ATI Radeon 9200 se s80 'sett squadron back on the assault'
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 8th Sep 2005 09:12
How's this?



Your signature has been erased by a mod because it's larger than 600x120...
xtom
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Ireland
Posted: 8th Sep 2005 19:36
Is there anyway to stop the words popping up on the first line? Also would it be easy to make a center text version?

Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 9th Sep 2005 07:00
in the wrapText() function, set the initial value of "Y" to "text height(s)" and it should skip the first line. Center text, I'm not sure about.

Your signature has been erased by a mod because it's larger than 600x120...
xtom
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Ireland
Posted: 9th Sep 2005 17:31
OK thx Phalex, I'll give that a try. I'm using this to display mission briefings in my game. Very useful snippet, I'll make sure to add your name to the credits.

Login to post a reply

Server time is: 2024-05-09 01:00:29
Your offset time is: 2024-05-09 01:00:29