(Final)NitroText - RPG-Like Output Text from FAT/Nitro

Learn to use DS Game Maker by Example!

Re: RPG-Like Output Text

Postby mudy247 » May 2nd, 2011, 4:05 am

ElderKain wrote:
mudy247 wrote:
ElderKain wrote:I wish there was a variable to change the text typing speed?
Is there a way that can be done?
I know you can put the "Wait for VBL" block in the same block area as the Draw frame / Draw limit objects as in Foxi4's example project, but that goes too slow.



What I did was I put
Loop frame from 0 to 2
Start Block
IF frame is equal to 2
Start Block

instead of 10 which made it faster somehow. I was just messing with it.


Hmmm when I modify that, it doesn't change the speed at all....
oh well, I can work around it.
That, and stylus tapping buttons, don't work all the time when it's on the same screen as the typing text....
So for this to work, i'm gonna have to change the screen locations on my project, lol.

I sure wish I knew how to call another object from an another object interaction...


That's odd. Whenever I make my number smaller it makes the text go faster. I could copy the code tomorrow and show you if you can't figure it out. I would right now but I don't have enough time to.
I bet if you messed around with the codes you could have the text and tapping buttons on the same screen. I've been messing with mine and it's working fine with the ones I have.

As for calling another object, that's something I could try and figure out. I've done visual basic coding before and I remember calling others to do an event.

But if someone else wants step up and help they can because I'm just a newb still :)
mudy247
 
Posts: 17
Joined: April 30th, 2011, 5:09 pm

Re: RPG-Like Output Text

Postby Foxi4 » May 2nd, 2011, 10:12 am

Obviously the smaller the loop the faster the text will be inputted. I set it to 10 by default, meaning that each 10 frames 1 character shows up. One second equals 60 frames, so You get about 6 characters per second in Real-Time.

If the loop will be between 0 and 2, the characters will show up at a 30 characters per second pace. If you don't see any changes, you most likely didn't accept the changes.

Also is there a way to call up another object from another object event?
like when i click a button object, it will start up what is inside another object.


Easier than it seems. Use the AppliesTo drop-box that pops up when using actions, that way you'll be able to tie them to specific Instances, Intance Types etc.
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: 1114
Joined: December 31st, 2010, 3:25 am

Re: RPG-Like Output Text

Postby Nobody » May 2nd, 2011, 10:50 pm

ElderKain wrote:I sure wish I knew how to call another object from an another object interaction...


What do yo mean call another object from another? If your talking about if something happens to this object then do this to a different object. One way, because i'm not sure what your trying to do because that demand is way to broad. Anyways, you could use global variables. A global variable is just a variable that can hold all sorts of information that can be accessed by any object. I could explain in more detail, but i need you to tell me what your trying to do first because i don't know where to go next.
Feel free to ask me for help. I'm on the forum a lot.

Recent Projects:
Crafters DS (Minecraft 2D Clone!) viewtopic.php?f=13&t=3082 (latest project!)
The Living Dead - viewtopic.php?f=13&t=1582
Mario Craft - viewtopic.php?f=8&t=1736 (Most Popular!)
Spawn Zombies - viewtopic.php?f=13&t=3444 (Newest)
User avatar
Nobody
 
Posts: 1941
Joined: February 14th, 2011, 12:08 am
Location: United States of America

Re: RPG-Like Output Text

Postby ElderKain » May 2nd, 2011, 11:11 pm

Nobody wrote:
ElderKain wrote:I sure wish I knew how to call another object from an another object interaction...


What do yo mean call another object from another? If your talking about if something happens to this object then do this to a different object. One way, because i'm not sure what your trying to do because that demand is way to broad. Anyways, you could use global variables. A global variable is just a variable that can hold all sorts of information that can be accessed by any object. I could explain in more detail, but i need you to tell me what your trying to do first because i don't know where to go next.

In my one Portal 2 Song project, instead of having all the lines in 1 post, just have it where the lines are in separate objects, since they will be called at different times to match up with the song.

I mean, like lets say the play button on the project starts up. After a sleep for a bit, it would call the first line in the karaoke sequence. The object itself wouldn't be places on the project itself, but the play button would be able to start that line sequence and the other lines as the song plays.

That's what I'm meaning.
ElderKain's DeviantArtDSGM v5.12 Project List/DLs (Under Construction) ●
/人 ◕ ‿‿ ◕ 人\ /人 ◕ ‿‿ ◕ 人\ /人 ◕ ‿‿ ◕ 人\ /人 ◕ ‿‿ ◕ 人\
ElderKain
 
Posts: 56
Joined: April 11th, 2011, 3:11 am
Location: USA Iowa

Re: RPG-Like Output Text

Postby Nobody » May 2nd, 2011, 11:18 pm

So if i'm right, then your trying to push a button and have the text/song play, and if it isn't pressed then don't do anything right?
Feel free to ask me for help. I'm on the forum a lot.

Recent Projects:
Crafters DS (Minecraft 2D Clone!) viewtopic.php?f=13&t=3082 (latest project!)
The Living Dead - viewtopic.php?f=13&t=1582
Mario Craft - viewtopic.php?f=8&t=1736 (Most Popular!)
Spawn Zombies - viewtopic.php?f=13&t=3444 (Newest)
User avatar
Nobody
 
Posts: 1941
Joined: February 14th, 2011, 12:08 am
Location: United States of America

Re: RPG-Like Output Text

Postby ElderKain » May 2nd, 2011, 11:34 pm

Nobody wrote:So if i'm right, then your trying to push a button and have the text/song play, and if it isn't pressed then don't do anything right?

right. And I don't want it all cluttered into the play button object.

Like how in programming languages use modules or class files to store functions and such to be used in the main code file. the main code file will call the function from the other class/module file and thus doesn't clutter the main file.

It's like how people make .css and .js files in HTML web-programming. They could all be done in that main htm/html file, but for non-clutter, they are stored in an external file and called from the main file.

That situation is similar to what I'm wanting to do.
ElderKain's DeviantArtDSGM v5.12 Project List/DLs (Under Construction) ●
/人 ◕ ‿‿ ◕ 人\ /人 ◕ ‿‿ ◕ 人\ /人 ◕ ‿‿ ◕ 人\ /人 ◕ ‿‿ ◕ 人\
ElderKain
 
Posts: 56
Joined: April 11th, 2011, 3:11 am
Location: USA Iowa

Re: RPG-Like Output Text

Postby Nobody » May 2nd, 2011, 11:55 pm

You could do this two ways. There are a few ways to do this, regardless how you do it, I think you need at least one global variable. Call this variable "Line" or something else that you now what it is and make it an integer (and of course this is a global variable. When play is pressed (Newpress), set "Line" to "Line" + 1. Tell it to clear text if you wish to do so too. Then in the step event say if "Line" is equal to X (X represents whatever number value present), then output this text. So if "Line" is equal to one, then create your first output text object. Then if it is equal to 2, then create the next text object and so on. If you want to just replace these objects simply use the same instance number. Say create these objects on instance 3. That way when a new item is created on instance 3, the old instance is deleted. That should work fine, or it might cause glitches, regardless if you need a better way then i'll give you one.
Feel free to ask me for help. I'm on the forum a lot.

Recent Projects:
Crafters DS (Minecraft 2D Clone!) viewtopic.php?f=13&t=3082 (latest project!)
The Living Dead - viewtopic.php?f=13&t=1582
Mario Craft - viewtopic.php?f=8&t=1736 (Most Popular!)
Spawn Zombies - viewtopic.php?f=13&t=3444 (Newest)
User avatar
Nobody
 
Posts: 1941
Joined: February 14th, 2011, 12:08 am
Location: United States of America

Re: RPG-Like Output Text

Postby Foxi4 » May 3rd, 2011, 12:23 pm

It would be much easier if you specified 1 TextBox...

Code: Select all
PA_InitTextBorders    (screen, x1, y1, x2, y2);


...erased the text within it using Alarms when necessary and output into it using...

Code: Select all
PA_EraseTextBox (screen);


...and clear Limit to 0, outputting new text into the box using...

Code: Select all
PA_SimpleBoxText (screen, text, limit);


That way the text will *always* appear in the designated area and you can change it at will with just 1 object, making it simple and easy to control.
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: 1114
Joined: December 31st, 2010, 3:25 am

Re: RPG-Like Output Text

Postby ElderKain » May 3rd, 2011, 1:32 pm

But I'm not gonna erase the text after when a new line is shown.
When the karaoke length fills the bottom area, it will then erase the text then start back at the top.
The title I'm working on is located at
viewtopic.php?f=13&t=1592
There is a Youtube video with has an example what the output would be like as the sing goes.
ElderKain's DeviantArtDSGM v5.12 Project List/DLs (Under Construction) ●
/人 ◕ ‿‿ ◕ 人\ /人 ◕ ‿‿ ◕ 人\ /人 ◕ ‿‿ ◕ 人\ /人 ◕ ‿‿ ◕ 人\
ElderKain
 
Posts: 56
Joined: April 11th, 2011, 3:11 am
Location: USA Iowa

Re: RPG-Like Output Text

Postby Foxi4 » May 3rd, 2011, 1:58 pm

*Exactly* the same principle is applied.

1. Alert initialization. Start.
2. Limit increases to a given point. Stop. New Alert time.
3. Alert reached, New line, Limit increases. Stop. New Alert time
4. Alert reached, Limit increases, Box filled. New Alert time.
5. Alert reached, Box cleaned, Limit set to 0, New text input.

This keeps it all in 1 box, and whenever an Alert is reached, you move to a new line. Lines don't have to be of equal lenght if you add an IF statement about the desired Max Limit per stage of the animation.

Keeping it in 1 box will give you that GLaDOS feel of computer output you're looking for. Everything will be nicely, tightly wrapped. I DID play Portal y'know, I know what kind of an output you want. ;)
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: 1114
Joined: December 31st, 2010, 3:25 am

Re: RPG-Like Output Text

Postby Foxi4 » June 20th, 2011, 4:13 am

Due to popular demand, I'm submitting a completely revised version of the RPGText code.

Here's the Source:
TextEngine with NitroFS.dsgm
(3.42 KiB) Downloaded 119 times


...and here's a test NDS:
TextEngine with NitroFS.nds
(321.34 KiB) Downloaded 109 times


Nope, you're not reading wrong! No more will you have to code every single string of text manually. Now NitroFS does it for you, reading simple .txt files! (...at least for the most part, you still need to specify where the .txt files are.)

The Source is supplied with a massive ammount of Comments to cover basically any question You may ask, but I'll be writing a more "detailed" tutorial if any of you find it difficult to use.

To sum it up, the engine allows you to pre-define the text box size and forget about it for the whole text-output, change fonts, change their colours, load strings straight from NitroFS, which saves alot of space, time and nerves and set any desired font print speed and any ammount of wait time between pages.

Enjoy and please do comment!
Last edited by Foxi4 on June 30th, 2011, 7:35 pm, edited 5 times in total.
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: 1114
Joined: December 31st, 2010, 3:25 am

Re: RPG-Like Output Text[Competely Revised, now using NitroF

Postby Nobody » June 20th, 2011, 4:26 am

sounds cool, but i'm too lazy to look at it due to i'm back away from DSGM.
Feel free to ask me for help. I'm on the forum a lot.

Recent Projects:
Crafters DS (Minecraft 2D Clone!) viewtopic.php?f=13&t=3082 (latest project!)
The Living Dead - viewtopic.php?f=13&t=1582
Mario Craft - viewtopic.php?f=8&t=1736 (Most Popular!)
Spawn Zombies - viewtopic.php?f=13&t=3444 (Newest)
User avatar
Nobody
 
Posts: 1941
Joined: February 14th, 2011, 12:08 am
Location: United States of America

Re: RPG-Like Output Text[Competely Revised, now using NitroF

Postby Foxi4 » June 20th, 2011, 9:06 am

Nobody wrote:sounds cool, but i'm too lazy to look at it due to i'm back away from DSGM.


The fun parts are actually done in C and PA_Lib. Actions are icing on the cake.
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: 1114
Joined: December 31st, 2010, 3:25 am

Re: RPG-Like Output Text[Competely Revised, now using NitroF

Postby TARDISam24 » June 20th, 2011, 9:57 am

Wow, this a big improvement :D Great work, I'm sure loads of people will find this useful, me included :)

A lot of the time there's an accompanying 'blip' for letters being 'typed'. Where would you put the play sound action for this in here? I can't seem to get it right...
For game walkthroughs and reviews, game production, game-related films and the occassional random thing, please visit my YouTube channel at:
http://www.youtube.com/user/TARDISam24
TARDISam24
 
Posts: 13
Joined: June 18th, 2011, 2:18 pm
Location: Coventry, England, United Kingdom

Re: RPG-Like Output Text[Competely Revised, now using NitroF

Postby Nobody » June 20th, 2011, 4:46 pm

TARDISam24 wrote:Where would you put the play sound action for this in here? I can't seem to get it right...

Haven't looked at the new actions yet, but if it's not included in the actions you have to do it like so. When you tell it to start outputting the text, also tell it to play and loop the sound. When the text is finished outputting, tell it to stop the background sound. I'm assuming this is for that ace attorney game?
Feel free to ask me for help. I'm on the forum a lot.

Recent Projects:
Crafters DS (Minecraft 2D Clone!) viewtopic.php?f=13&t=3082 (latest project!)
The Living Dead - viewtopic.php?f=13&t=1582
Mario Craft - viewtopic.php?f=8&t=1736 (Most Popular!)
Spawn Zombies - viewtopic.php?f=13&t=3444 (Newest)
User avatar
Nobody
 
Posts: 1941
Joined: February 14th, 2011, 12:08 am
Location: United States of America

Re: RPG-Like Output Text[Competely Revised, now using NitroF

Postby Foxi4 » June 20th, 2011, 9:14 pm

TARDISam24 wrote:Wow, this a big improvement :D Great work, I'm sure loads of people will find this useful, me included :)

A lot of the time there's an accompanying 'blip' for letters being 'typed'. Where would you put the play sound action for this in here? I can't seem to get it right...


Put the Play Sound action right under the limit increase, so that it "blips" everytime a new letter is printed. Watch out though - the strings are all set to have a default lenght to keep things simple - if they're shorter than the Max Limit, you will get "blips" when nothing's printing (aka, blips when the system outputs "spaces").

This is because the char* Text variable, when reading a new string from a file that's shorter than the previous one "leaves out" the "latter" characters from the previous one and there's nothing you can do to change that other than adding spaces to cover them up until you reach the limit. Not only that, PA_EraseTextBox(u8 screen); is *quite* buggy and seems to work whenever it really wants to.

When creating Text files, make sure that after your input is complete, you filled out the rest of "space" with "spaces". (See what I did there?)

Plan your output and limits ahead if you want to use this effect, for example by using a MaxLimit variable that differs for each .txt file, making the limit dynamic.


When MaxLimit will be reached, the blips would stop - fairly easy to add to the code.

You can do that in the exact same way I declared the Paths array.

EXAMPLE:

Code: Select all
u8 MaxLimit[AmmoutOfYourTextFiles]; //u8 - unsigned 8
MaxLimit[1] =
MaxLimit[2] =
etc. etc.

...and alter the Clear Screen module, wrapping it in:

If Variable limit ==(is equal to) MaxLimit[TextLine]
Start Block
*Everything else specified in the module*
End Block


I personally didn't think it was a *necessary* function, but since you pointed it out, there you go.
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: 1114
Joined: December 31st, 2010, 3:25 am

Re: RPG-Like Output Text[Competely Revised, now using NitroF

Postby Mint » July 1st, 2011, 7:55 pm

You know, Foxi is really involved yet he/she has no profile picture.
ATTENTION ALL BRONIES!
You can't take over the DSGM forum. So don't try.
You're welcome here but we all don't have to know you like My Little Pony.

Woot, me gots da Obj-C'z on ma windows ocho-huit-eight!!!
User avatar
Mint
 
Posts: 969
Joined: May 23rd, 2011, 10:25 pm
Location: Liberty City, USA

Re: RPG-Like Output Text[Competely Revised, now using NitroF

Postby Foxi4 » July 1st, 2011, 8:13 pm

Heh, I have profile pictures on DS-Scene and on GBATemp, I thought one isn't really necessary on a programming forum. XP I'll think of something soon enough though.
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: 1114
Joined: December 31st, 2010, 3:25 am

Re: RPG-Like Output Text[Competely Revised, now using NitroF

Postby Foxi4 » July 1st, 2011, 8:23 pm

There you go. Happy? XD
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: 1114
Joined: December 31st, 2010, 3:25 am

Re: RPG-Like Output Text[Competely Revised, now using NitroF

Postby Foxi4 » July 18th, 2011, 8:38 pm

Seeing that I'm such a "lib nut" lately, I made another one due to a few requests.

The previous example needed separate text files for each line of text output. No more will that be a problem. Introducing NitroText lib!

Code: Select all
FAT_ParseTextFile(char* textfile, u8 line);


Parses a given line from a specified textfile to be ready-to-input. No need for any special variables, the function returns the line automatically. Just use it, for example, like this:

Code: Select all
PA_OutputText(Screen, X, Y, "%s", FAT_ParseTextFile(char* textfile, u8 line));


...and you're in for a treat!

Example attached, I hope you'll all enjoy the new addition. Yes, I will merge all the functions together into FAT_ResourcesLib at some point, I'm just too lazy at the moment. >>;
Attachments
NitroText.dsgm
(1.8 KiB) Downloaded 74 times
NitroTextLib.h
(781 Bytes) Downloaded 64 times
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: 1114
Joined: December 31st, 2010, 3:25 am

PreviousNext

Return to Tutorials & Examples

Who is online

Users browsing this forum: No registered users and 1 guest