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.

DarkBASIC Professional Discussion / Talk to 3d object?

Author
Message
Mugen Wizardry
User Banned
Posted: 19th Jul 2010 15:51 Edited at: 19th Jul 2010 15:51
How can I make my camera or player talk to another object and display it typing the text 1 by 1 with wordwrap in a textbox that is at the bottom middle of the screen?

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 19th Jul 2010 16:24
You will have to get a plugin or do it yourself. Take a look at text width().

The fastest code is the code never written.
Mugen Wizardry
User Banned
Posted: 19th Jul 2010 16:30
sorry. i don't do plugins.

does anyone know where to find these functions?

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 19th Jul 2010 16:44
It's probably best to think of your long string of text as individual lines that are calculated. You know the width limit that the text has to stick to, but you might not know the number of lines you'll need right away. You will need all of this worked out before you can 'type' the text onto the screen.

Maybe step through the string, character by character, adding the character to a string array. When you hit a space or the end of the string, store that position - then if the width of the text exceeds the window width, wind back to that previous space, and start a new line there.

What you'd end up with is a little array of strings, each one formatted to be the right width for a set width window. It's really the text handling part that's difficult, like splitting the text up, even once you know exactly where and how long the text should be. Once you get the text into an array, then you can step through and extend the displayed text as you go, so one character at a time, just by using LEFT$ as you already have the exact string of text you need.


Health, Ammo, and bacon and eggs!
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 19th Jul 2010 17:14
You can do a little math using text width(). Or you can, as I think Van B is saying, write the entire text one letter at a time until you get to the edge then back up to the last space and start a new line. This can be done with an array of strings. You will still have to use "text width()".

The fastest code is the code never written.
Mugen Wizardry
User Banned
Posted: 19th Jul 2010 17:30
ok, i have the typewriter function.

now i need to know how to use this as a 3d function, put it in a textbox positioned at the bottom middle of the screen, and wrap the text.



CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Mugen Wizardry
User Banned
Posted: 19th Jul 2010 17:37
better yet, i have combined 2 examples.

problem is i need it to return the final$ variable instead of using text to type it so it appears in the window that tdk made.



CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Mugen Wizardry
User Banned
Posted: 19th Jul 2010 18:34
Does anyone know why when i take out the text command in typewrite(), and do endfunction final$, it doesnt work?

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 19th Jul 2010 18:36
Because then it's not writing it out one letter at a time is it...

[b]
Mugen Wizardry
User Banned
Posted: 26th Jul 2010 17:06
i dont know why..

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Mugen Wizardry
User Banned
Posted: 26th Jul 2010 17:25
can someone help me on this?

whoever does, i will allow u to release it in the codebase and take the credit.

i REALLY need this code.

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Mugen Wizardry
User Banned
Posted: 27th Jul 2010 16:54
can someone please help?

i waited 24 hours to bump

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Mugen Wizardry
User Banned
Posted: 28th Jul 2010 21:02
i still can't
get this code
to work..

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 28th Jul 2010 23:05
I'm not sure I fully understand what you're trying to do?

Just run through the sequence of events you are trying to achieve here and maybe you'll get a clearer response to a clearer problem...

I just spent ten-15 minutes trying to work out what you are struggling with

Mugen Wizardry
User Banned
Posted: 28th Jul 2010 23:35 Edited at: 28th Jul 2010 23:36
i'm trying to
make it so
that the text
has wraphttp://forum.thegamecreators.com/?m=forum_edit&i=2058600&b=1&t=172860&p=0
and types 1
letter at a
time.

i also need
it when it
reaches the end
of the string,
it says "continue"
at the bottom
of the box
just like in
zelda wind waker

i need it
to make a
noise for the
letter, and i
need the option
to color a
word like it's
important.

Like:
Town of Oxfordshire

Town of
would be blue
Oxfordshire
would be green.

thanks, baxslash!

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 29th Jul 2010 23:28 Edited at: 29th Jul 2010 23:30
Those carriage returns are very annoying.

But to answer your question, you should (In my opinion) write a function which you can call once every game loop, which will wait a set amount of time before showing the next letter.

(Kind of like this...)


This is a very basic *working* teletype code which YOU should then customise for your own needs. It would be easy, and up to you to add both the sound, and the color changing bits. (I wouldn't want to write the whole thing for you!)

My signature is NOT a moderator plaything! Stop changing it!

Login to post a reply

Server time is: 2026-07-25 08:29:39
Your offset time is: 2026-07-25 08:29:39