The Daily Click ::. Forums ::. Klik Coding Help ::. question about in game texts
 

Post Reply  Post Oekaki 
 

Posted By Message

siven

I EAT ROCKS

Registered
  03/11/2008
Points
  604

Wii OwnerVIP Member
10th January, 2015 at 10/01/2015 22:12:22 -

so like, you know in pokemon games and rpg's and such how the text appears one letter at a time? how does one do this? ive never messed with it, but its something that would be helpful lol

 
[Game design makes my brain feel like its gonna explode.]

GamesterXIII



Registered
  04/12/2008
Points
  1110

I am an April Fool
10th January, 2015 at 10/01/2015 23:08:23 -

A lot of people use Text Blitter. I have no experience with it so I can't help you with that one specifically.

The method I use utilizes counters, strings, and string functions ( Left$ & len specifically)

If you don't know.

Left$(String, NUMBER) returns the NUMBER of characters on the left side of a string - that you specify.

EG:

Left$("Hello World!",7) would return:

"Hello W"

Left$("Hello World!", would return:
"Hello Wo"

etc. etc.

Len(String) returns the number of characters in a string.

Len("Hello World!") would return the number 12. Spaces count as a character.

Before making this full-fledged you need to decide whether or not you need "infinite" lines OR you can make due with only a few.

I, personally, store text in Alterable Strings and use a behavior, that can be applied to any object, to handle the activation of the text events. The problem with this method is that you can ONLY have 14 Alterable Strings per object. I usually reserve the first String for the Characters Name, and one string for ending the code.

Here is a basic example of what I'm talking about. This only utilizes one object, but can be applied to any number of objects with some modification.

https://www.mediafire.com/?ur5yf36kez0tww6

Press space to make the text start, and also to swap to the next line whenever one is completed.







Edited by GamesterXIII

 
n/a

nivram



Registered
  20/07/2006
Points
  171
11th January, 2015 at 11/01/2015 01:19:34 -

I have two or three "Typewriter" open source examples on my website.

Marv

 
458 MMF2 & CTF 2.5 examples and games

http://www.castles-of-britain.com/mmf2examples.htm

The_Antisony

At least I'm not Circy

Registered
  01/07/2002
Points
  1341

VIP MemberStarSnow
11th January, 2015 at 11/01/2015 14:59:33 -

Pretty simple. You shouldn't need to use any extensions for this;

Create 2 String Objects.
Name one String Object "Dialog" and the other "Display".
Create an Active Object.
Name the Active Object "Data".
Create an Alterable Value in the Active Object called "ParaNum".
Create an Alterable Value in the Active Object called "NumOfChars".
Create an Alterable Value in the Active Object called "CharNum".
Create an Alterable String in the Active Object called "Char".

The Active Object is only required since we need to store Alterable Values and Strings. On your project, you should be able to use an existing object to store the values and strings instead of creating a new one.

Jump into the event editor.
Start of Frame:
Dialog -> Display Paragraph Random(npara("Dialog"))
Data -> Set Alterable Value "ParaNum" to Paragraph("Dialog")
Data -> Set Alterable Value "NumOfChars" to Len$(paragraph$("Dialog", ParaNum("Data")))
**Example grabs a random paragraph from Dialog, sets ParaNum to the paragraph picked, then sets NumOfChars to the number of characters in that paragraph.

Every 10 miliseconds +
Data -> CharNum("Data") < NumOfChars("Data"):
Special Conditions -> Activate Group "Type".
**So long as the current character printed is less than the number of characters in the selected paragraph, we keep activating the Type group which grabs one character at a time and prints it to Display. This just makes sure the group doesn't continue to activate after the entire paragraph has been printed.

CharNum("Data") >= NumOfChars("Data"):
Special Conditions -> Deactivate Group "Type".
Data -> Set Alterable Value NumOfChars to 0.
Data -> Set Alterable Value CharNum to 0.
**This event just resets everything. If you'd like to display a sequence of paragraphs, make sure you reset the alterable string in Display to "" before anything else on your key-press event. Otherwise, each paragraph will simply add to the last instead of clearing the Display first.

Now we need to create a new group of events. Call it "Type" and make sure it's NOT activated at the start of frame. We don't want these events running unless there's text to supply. Inside the group, create two Always events.

Type Group:

Always:
Display -> set Alterable String$("Display")+Mid$(paragraph$("Dialog", ParaNum("Data")), CharNum("Data"),1)
Data -> Add 1 to Alterable Value "CharNum"
**We're using "Mid$" to pull a character from the CharNum position in Dialog and for a length of 1. This would get a lot more complicated trying to use Left$ or Right$ instead.

Always:
Special Conditions -> Disable Group "Type".
**I know it seems weird having two "always" events one after the other, but because they run in order, they still complete successfully.

That's it. Seven events, three of which don't run unless you activate the typewriter effect by changing the paragraph number, updating Data's ParaNum and NumOfChars alterable values, and activating the Type group. This example picks a random paragraph at the start of the frame to type.

It's possible to trigger the event with fewer conditions. It's also possible to do all of this with one string object instead of using two. Just thought this method would be easier to understand.


Edited by The_Antisony

 
ChrisD> Employer: Say, wanna see a magic trick?
ChrisD> Employee: Uhh… sure, boss.
ChrisD> Employer: Your job! It just disappeared! Pack your things and leave! Pretty good trick, huh?

siven

I EAT ROCKS

Registered
  03/11/2008
Points
  604

Wii OwnerVIP Member
12th January, 2015 at 12/01/2015 23:57:52 -

Thanks for the replies everyone! ill probably end up trying out all the different methods to see which fits best

 
[Game design makes my brain feel like its gonna explode.]
   

Post Reply



 



Advertisement

Worth A Click