Text Help

Stuck? This is the place to go to get and give help.

Text Help

Postby bojoradarial » February 18th, 2012, 8:51 pm

A few questions...

I want a character to speak, then when you press A, the character continues to talk, then when you press A again, the character continues to talk. How do you do that?

Can you make your own text? If so, how?

Note that I do not understand any script!
Last edited by bojoradarial on February 21st, 2012, 9:11 pm, edited 1 time in total.
bojoradarial
 
Posts: 9
Joined: February 17th, 2012, 11:14 pm

Re: Text Help

Postby memefefe » February 20th, 2012, 5:44 pm

This has always eluded me! I can never seam to make an engine that works right like this!
Who doesnt wanna watch a weirdo tumble?
http://kawaiiweirdo.tumblr.com
memefefe
 
Posts: 952
Joined: August 19th, 2011, 3:35 am
Location: The infinite expanses of my mind

Re: Text Help

Postby Foxi4 » February 20th, 2012, 6:01 pm

Oh, that's easy - it does require some C knowledge.

Text is stored in Strings so it's relatively easy to determine their lenght using the strlen function:
http://www.cplusplus.com/reference/clib ... ng/strlen/

Knowing this, you know exactly when the character stops talking - when the last character is printed.
PA_SimpleBoxText(Screen, "Text", Limit) is quite handy here since it returns the ammount of printed characters.

How to use this knowledge? Time for some coding, starting from Step:

Code: Select all
if(Print==true){
if(PA_SimpleBoxText(1, String, Limit)==strlen(String)){
Print==false;
}
}


What does it mean? Well, if boolean Print is equal to true, text is printed into the pre-inited Text Box until the number of letters returned is equal to the size of the string, then printing ends.

Now, how to start printing another thing? Well, that's also easy!

Code: Select all
if(Pad.Newpress.A && Print==false){
free(String);
String=NULL;
String="New Text";
Print=true;
}


...if you press the A button and there is no text currently being printed, a new text is assigned to the String. You can automate it using NitroText and load the string from a text file with ease, making printing even tidier!

Remember to initialize the box! PA_InitTextBorders (u8 screen, u8 x1, u8 y1, u8 x2, u8 y2)!

Of course this is just one way of doing it, it's best to play around a bit and think of your own method. :)

Refer to my TextBox Tutorials by the way, you may find alot of interesting snippets, both in NitroText and in the standard TextBox code. :)
Current Projects:

FalloutDS: Postponed until proper libraries are created, 10%
Foxi_Lib: A completely revised version of NitroSprites[FINAL], NitroBackgrounds and NitroText[FINAL], 40%
Foxi4
 
Posts: 1119
Joined: December 31st, 2010, 3:25 am

Re: Text Help

Postby Bobbyloujo » February 20th, 2012, 6:16 pm

Foxi beat me to it... here's something a little simpler...
Attachments
dialog.dsgm
(1.23 KiB) Downloaded 16 times
Seriously never posting again, lawlz.
jk
Bobbyloujo
 
Posts: 1299
Joined: December 30th, 2010, 8:40 pm
Location: Uh-merica

Re: Text Help

Postby Foxi4 » February 20th, 2012, 6:32 pm

You need a lockout in place Bobby, otherwise you'll be able to increase Dialogue even when the input hasn't finished. Plus, OutputText prints all the text at once. ;)
Current Projects:

FalloutDS: Postponed until proper libraries are created, 10%
Foxi_Lib: A completely revised version of NitroSprites[FINAL], NitroBackgrounds and NitroText[FINAL], 40%
Foxi4
 
Posts: 1119
Joined: December 31st, 2010, 3:25 am


Return to Help

Who is online

Users browsing this forum: No registered users and 0 guests