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 / WordWrap In the making- first version

Author
Message
John H
Retired Moderator
21
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 1st Jan 2003 23:34
Here is the first version of my wordwrap. If the string is too long then it makes it into 2 shorter strings



Remember this is a very, very first version of it. When I finish it will be better

For those of you who cant use code windows, heres the code out of it

test$="THIS IS A TEST STRING- I AM MAKING IT WAY TOO LONG FOR A REASON"
stringlength#=len(test$)
halfway#=len(test$)/2
if len(test$)>20
cls
print left$(test$,halfway#)
print right$(test$,halfway#+1)
else
print test$
endif

RPGamer
Current - RPG: Eternal Destiny : Help Wanted!
http://www.halbrosproductions.netfirms.com
Dont ask those questions! Read the help files lazy!
Easily Confused
21
Years of Service
User Offline
Joined: 22nd Oct 2002
Location: U.K. Earth. (turn right at Venus)
Posted: 2nd Jan 2003 00:26
Perhaps I can help.



(sheds a tear for the lamb)...sniff

Programming anything is an art, and you can't rush art.
Unless your name is Bob Ross, then you can do it in thirty minutes.
John H
Retired Moderator
21
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 2nd Jan 2003 18:28
Heheehhe I was just going to go about coding that too Good thing my code from my head was simliar too that Great minds think alike

RPGamer

Current - RPG: Eternal Destiny : Help Wanted!
http://www.halbrosproductions.netfirms.com
Dont ask those questions! Read the help files lazy!
jasuk70
21
Years of Service
User Offline
Joined: 3rd Dec 2002
Location: Hemel Hempstead
Posted: 2nd Jan 2003 20:08
Thanks EC, I've used a version of that for my purposes (It was faster than my attempt at the same sort of thing)

Any way of speeding it up I wonder. String Manipulation seems pretty slow in DBPro.

Jas
John H
Retired Moderator
21
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 2nd Jan 2003 22:53
I always suggest making things yourself I really posted this for learning purposes- and if someone wanted to do things the quick way then they can use it. Then EC came along and stole my post....... JK man nice code Well, I guess there is really no point in changing mine now!

RPGamer

Current - RPG: Eternal Destiny : Help Wanted!
http://www.halbrosproductions.netfirms.com
Dont ask those questions! Read the help files lazy!
Easily Confused
21
Years of Service
User Offline
Joined: 22nd Oct 2002
Location: U.K. Earth. (turn right at Venus)
Posted: 2nd Jan 2003 23:37
D'oh! (slaps forhead), Sorry, I had not considered that

I will now write out 1000 times: "I will not interfere with other peoples posts!"

Programming anything is an art, and you can't rush art.
Unless your name is Bob Ross, then you can do it in thirty minutes.
Easily Confused
21
Years of Service
User Offline
Joined: 22nd Oct 2002
Location: U.K. Earth. (turn right at Venus)
Posted: 3rd Jan 2003 00:29
..hmmm, I think:

until (text width(left$(s$,pos)) >= bitmap width()) or (pos = len(s$))

should idealy be:

until (text width(left$(s$,pos)) > bitmap width()) or (pos = len(s$))

Programming anything is an art, and you can't rush art.
Unless your name is Bob Ross, then you can do it in thirty minutes.
John H
Retired Moderator
21
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 3rd Jan 2003 04:52
Yep- good plan

Current - RPG: Eternal Destiny : Help Wanted!
http://www.halbrosproductions.netfirms.com
Dont ask those questions! Read the help files lazy!
Hamish McHaggis
21
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 3rd Jan 2003 15:54
ahhhh... but if you have a word that is longer than a line then it gets stuck in a loop. Just something else for u to do.

Yum! Yum! Yum! Yum!
Epidemicz
21
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 3rd Jan 2003 18:52
Well....I don't think anyone is going to have any words like "Antidisestablishmentarianism" in their program, heh.

I am the very disease you pretend to be.
John H
Retired Moderator
21
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 9th Jan 2003 04:07
Ya but you could have a character be like surprised and say like ad;flafdafdj Lol..... maybe

Current - RPG: Eternal Destiny : Help Wanted!
http://www.halbrosproductions.netfirms.com
Dont ask those questions! Read the help files lazy!
adamsmasher23
21
Years of Service
User Offline
Joined: 31st Jan 2003
Location: United States
Posted: 6th Feb 2003 02:00
EC, how do you get your program to recognize the words in the string? I'm trying to make a sentence recognition program and need to be able to read individual words.

Whatever I did it wasn't me!
Easily Confused
21
Years of Service
User Offline
Joined: 22nd Oct 2002
Location: U.K. Earth. (turn right at Venus)
Posted: 6th Feb 2003 03:26
If you're using DBPro, you may wish to try this:



Programming anything is an art, and you can't rush art.
Unless your name is Bob Ross, then you can do it in thirty minutes.
Easily Confused
21
Years of Service
User Offline
Joined: 22nd Oct 2002
Location: U.K. Earth. (turn right at Venus)
Posted: 6th Feb 2003 03:28
...I hope this is what you need

Programming anything is an art, and you can't rush art.
Unless your name is Bob Ross, then you can do it in thirty minutes.
adamsmasher23
21
Years of Service
User Offline
Joined: 31st Jan 2003
Location: United States
Posted: 6th Feb 2003 03:51
Umm, is there any way I could use that on DBC w/dark matter?

Whatever I did it wasn't me!
Easily Confused
21
Years of Service
User Offline
Joined: 22nd Oct 2002
Location: U.K. Earth. (turn right at Venus)
Posted: 6th Feb 2003 04:12
Try this:



Programming anything is an art, and you can't rush art.
Unless your name is Bob Ross, then you can do it in thirty minutes.
adamsmasher23
21
Years of Service
User Offline
Joined: 31st Jan 2003
Location: United States
Posted: 6th Feb 2003 15:07
Is there a way you could store the words in an array?

Whatever I did it wasn't me!
Easily Confused
21
Years of Service
User Offline
Joined: 22nd Oct 2002
Location: U.K. Earth. (turn right at Venus)
Posted: 6th Feb 2003 22:34
The words are stored in the wordlist$() array in the new example.

...unless you're having trouble getting the example to work?

Programming anything is an art, and you can't rush art.
Unless your name is Bob Ross, then you can do it in thirty minutes.
Kangaroo2
21
Years of Service
User Offline
Joined: 26th Sep 2002
Location: United Kingdom
Posted: 6th Feb 2003 23:27
I was already doing this but thanx 4 confirming I was doing it properly

A sensible time when a single word might be long than one line is a weblink, Eg

http://www.unnecessarily-long-hosting-provider.org.uk/free-space-user/mypage.html

OR even more pheasably:
http://www.google.com/search?q=kangaroo2+darkbasicpro+bounce&btnG=Google+Search&hl=en&lr=&ie=UTF-8&oe=UTF-8

HEY I'm number 1 on Google! lol

Admittedly there are ways round that, but just tht I'd point out its not as unncommon as you might think.

Coming Soon! Kangaroo2 Studio... wait and quiver with anticipation! lol
samjones@kangaroo2.com - http://www.kangaroo2.com - If the apocalypse comes, email me
adamsmasher23
21
Years of Service
User Offline
Joined: 31st Jan 2003
Location: United States
Posted: 8th Feb 2003 01:20
This is the first version of the learning program. the only problem is that it won't write to a file if it already exists!! can u help me with this?

Whatever I did it wasn't me!
adamsmasher23
21
Years of Service
User Offline
Joined: 31st Jan 2003
Location: United States
Posted: 8th Feb 2003 01:21
oops, i forgot the code



Whatever I did it wasn't me!
=C=
20
Years of Service
User Offline
Joined: 8th May 2003
Location: United Kingdom
Posted: 22nd Jun 2003 21:53
Unfortunetly this piece of code only works when you disable

`Sync On
`Sync Rate 30
`backdrop on
`color backdrop rgb(0, 0, 20)

any one know the reason why? any work arounds?

I am going to start disabling and enabligh this settings before i write the text but i dont think it will work...

-------------------------------
Pointy birds, Oh pointy pointy
Anoint my head, Anointy 'nointy
=C=
20
Years of Service
User Offline
Joined: 8th May 2003
Location: United Kingdom
Posted: 22nd Jun 2003 22:03
Nope it is not as simple as that!

if you do:

Function wordwrap(s$)
sync off
backdrop off

backdrop on
sync on
endFunction

will go in once and it will get stuck there... It is a tricky one this...

-------------------------------
Pointy birds, Oh pointy pointy
Anoint my head, Anointy 'nointy
Inkybro
21
Years of Service
User Offline
Joined: 31st Dec 2002
Location: Where I live :)
Posted: 23rd Jun 2003 20:24
Hey, easily confused, don't write it 1000, just infinitie, this way you can leave it.

DO
Print "I will not interfere with other people's posts"
LOOP

K?

Don't turn your back on me, I won't be ignored! Faint - Linkin Park

One minute your on top! Next you're not, watch you drop! Linkin Park- Hit the Floor
Mattman
20
Years of Service
User Offline
Joined: 5th Jun 2003
Location: East Lansing
Posted: 23rd Jun 2003 20:46
or, for 1000 u could do

for A# = 1 to 1000
do
print "I will not interfere with other people's posts"
next A#
if A# = 1000 then exit
loop

lol!!!

---Mattman
"Computers make it easier to do a lot of things, but most of the things they make it easier to do don't need to be done." Andy Rooney
ReD_eYe
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 24th Jun 2003 20:37
did you try running that code mattman???you get an error
try
for a=1 to 1000
print "i will not not interfere with other people's posts"
next a

hi guys
Drum
21
Years of Service
User Offline
Joined: 10th Apr 2003
Location:
Posted: 3rd Jul 2003 09:55
Hey,

Could someone post a word wrap which would be suitable for text boxes in RPG's or chats etc.

I have tried myself and almost got it working but when i tried to implement it in my program its driving me crazy beacause of a number of reasons. So if anyone would post an effiant way of doing this it would be much appreciated.

THanx
Nick

Steverino
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United States
Posted: 4th Jul 2003 19:00
Here's my old word wrap solution, but for some reason it only works in DB classic.

____________________________________________
Surrealist writing toy -- http://www.iconpoet.com
Steverino
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United States
Posted: 4th Jul 2003 20:12
Okay, this source box has the same thing only for DB Pro. Apparently they handle variable values in functions differently. Also, it seems the default text height was 16 in DBC and is only 15 in DBP.

____________________________________________
Surrealist writing toy -- http://www.iconpoet.com
Drum
21
Years of Service
User Offline
Joined: 10th Apr 2003
Location:
Posted: 11th Jul 2003 09:22
cool, im sure that will help alot of people inthe future,.

Drum
nick
John H
Retired Moderator
21
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 12th Jul 2003 01:08
Man two of my old posts are back from the dead. Yikes! Ya my code was pretty crappy - took only a few minutes lol Asheron has done some pretty good RPG word wraps over at RGT.

RPGamer

Current Project: Eternal Destiny
Questions? Comments? Suggestions? Go to the Eternal Destiny Forum!

Login to post a reply

Server time is: 2024-04-19 19:37:51
Your offset time is: 2024-04-19 19:37:51