Stencyl 3.4.0 is now out. Get it now!

[SOLVED] How to make typewritten text?

RosalinaGalaxer

  • Posts: 36
I'm trying to make scrolling text as in text where each character gets put on screen one after the other, like Zelda or Undertale. I've tried doing this by doing something like the below code, but that only draws the first character, then stops. Any ideas?

P.S. I do know about the Dialog Extension, but it refuses to work for me...

« Last Edit: August 18, 2017, 12:14:09 pm by RosalinaGalaxer »

JeffreyDriver

  • Posts: 1116
The way you're approaching this looks like an over complicated way to do it. Not to mention a long way.

Anyway, to get your method working, you'd have to use booleans to get the different letters to display, but as I say, it's not the way to do it.

Also, you only need to set the current font once.

I'm trying to think of a better way to display text with a typewriter effect. Without the dialogue extension it's going to be a lot of work.

I suppose that one approach would be to use the blocks under NUMBERS & TEXT > TEXT to split your text up and put it in a list, then recall every letter after a short time, say 0.1 seconds and add those to a text attribute.

RosalinaGalaxer

  • Posts: 36
I knew that it would long and complicated to do this the way I was trying to. That's why I came here to see if anyone else had a better idea. I just couldn't think of a better way to do it.

Also, I thought that since it was inside the "do after" block, the font would need to be changed again.

I don't much work with lists (yet, I have a feeling I'm going to pretty soon.) so could show me what you meant when you spoke of them in your post?

Thanks for your help, by the way!

svintaj

  • *
  • Posts: 278
That draw code will run once for each frame, over and over again, so you can't do it that way.
Draw only one string instead, and from another place in your code(Not from draw or always) change that string by adding an character to it every second or when needed. Like this:

H
He
Hel
Hell
Hello
Hello!

Play a sound when you add a letter, and it will sound like an old typewriter ;-)

LIBERADO

  • *
  • Posts: 2345
@RosalinaGalaxer, that is not scrolling text, that is typewritten text.
   
You can easily make it in this way:
   

   
The result:
   
<a href="http://static.stencyl.com/games/37396-0.swf" target="_blank" class="new_win">http://static.stencyl.com/games/37396-0.swf</a>

I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.

RosalinaGalaxer

  • Posts: 36
Thanks, Liberado, I'll try that tomorrow. Thanks for telling me that it was typewritten text as well, I just couldn't find a better word for it than scrolling.

That is all the blocks needed, correct?

RosalinaGalaxer

  • Posts: 36
Also, is there any way to make the text pause midsentence? For periods/commas, etc.

LIBERADO

  • *
  • Posts: 2345
That is all the blocks needed, correct?
Yes, it is that simple.
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.

LIBERADO

  • *
  • Posts: 2345
Also, is there any way to make the text pause midsentence? For periods/commas, etc.
Yes, but the more feaures you want, the longer and more complex the code will be.
For this reason, the great Dialog Extension is recommended to make the job much easier.
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.


Eriko

  • Posts: 151
@RosalinaGalaxer, that is not scrolling text, that is typewritten text.
   
You can easily make it in this way:
   

   
The result:
   
<a href="http://static.stencyl.com/games/37396-0.swf" target="_blank" class="new_win">http://static.stencyl.com/games/37396-0.swf</a>


Excellent, Liberado. Ididn't think of that. It's so simple. 

fillergames

  • Posts: 691
Personally, I'd store the text as a game attribute if I were you.

Just to add some more on top of it, you can use the "part of text" block to draw more than 1 line so that multiple lines can be formed from a single text string.



I have also programmed a internal scripting format based off minor checks that allow various formats. The text is stored in behaviors, or with scene scripts to allow full control of what text is said.



As a rough translation:

"~" means to manually lower the text to the next line

"\(Y/N)" displays the yes or no text box, as the options that happen when yes or no are selected are based off scripts per scene. The option itself is an actor disguised as text so that I can select what happens when yes or no are clicked when it's erased from the scene.

My text engine also supports pausing mid-text, too. With simple character detection to pause text, or with scripts inside the text.  (excuse my immaturity on the text)



Personally, if you were serious with making game design, I'd rather not use the dialog extension. As it's more rewarding (and less limited) coding up your own engine for drawing text. It's not as hard as some make it to be.

« Last Edit: September 01, 2017, 10:15:51 pm by fillergames »

RosalinaGalaxer

  • Posts: 36

Whoa, that looks pretty complicated. Just looking at it right now doesn't make much sense. Could you explain it a little bit more, 'cause that actually looks really useful for what I'm doing.
I have also programmed a internal scripting format based off minor checks that allow various formats. The text is stored in behaviors, or with scene scripts to allow full control of what text is said.