LoginLogin

Text stuff

Root / Programming Questions / [.]

Retrogamer123Created:
How do you make text that appears one letter at a time, like when a person talks in some RPGs?

I use FOR loops with LEFT$. FOR I=0 TO LEN(YOLO$)-1 CLS ?LEFT$(YOLO$,I) WAIT 5 NEXT If you want it any more complex, then you can hopefully work it out based on this. Hope this helps!

Alternatively, you could try something involving semicolons. When printing text, you can put a semicolon after the ending quotation mark to stop the program from automatically time breaking. Whatever you do to make it go through each letter individually is up to you.

How do you make text that appears one letter at a time, like when a person talks in some RPGs?
I use FOR loops with LEFT$.
FOR I=0 TO LEN(YOLO$)-1
CLS
?LEFT$(YOLO$,I)
WAIT 5
NEXT
You can also avoid repetition by making your own command:
DEF TEXTTALK X,Y,S$,SPEED
 FOR I=0 TO LEN(S$)
  LOCATE X,Y:PRINT LEFT$(S$,I)
  BEEP 9
  VSYNC SPEED
 NEXT
END
Then, whenever you use something like TEXTTALK 0,0,"Hello. I am talking text.",3 then it should do as you described, Retro. You can use it in Direct mode (If the DEF command is in slot 1.) and in Edit mode.

How do you make text go in front of everything on the screen?

If you're using the console, use LOCATE X,Y,Z where Z is lower than any others, like sprites and stuff. (min -256 or -255 idunno) If you're using graphics, use GPRIO Z with the same sort of idea. Have an amazing day, and as always, use autofill and the help button TO GET A BASIC UNDERSTANDING OF THE COMMANDS YOU'RE USING.

Console screen (Just text characters):
LOCATE X,Y,-256
Graphic screen (Graphics obviously):
GPRIO -256
DisadvantageEverything drawn on the graphics screen will be in front of everything else.
Sprites:
SPOFS MN,X,Y,-256
BenefitsYou can make characters individually moving around or something else.
DisadvantageYour text must have less than 512 characters shown at a time. (Even less if you use sprites for something else.)
If you get confused, don't worry, the autocomplete and the help button are there for you. (lol XD)

upgraded version of my post
Your text must have less than 512 characters shown at a time. (Even less if you use sprites for something else.)
Not quite true. You can use sprites for both gameplay and text by moving the text away from where your regular sprites are stored. Just wanted to make this clear.

...
Not quite true. You can use sprites for both gameplay and text by moving the text away from where your regular sprites are stored. Just wanted to make this clear.
What I mean is... There are 512 available slots for sprites and as you said, there could be some sprites already used for enemies or the player itself, a few slots became used. What you mean is (i guess)... You can think about you need up to 256 slots for example just for gameplay elements and after slot 256, you can use 255 character sprites to make text out of them. That's what I meant with
the spoiler"Even less (than 512) if you use sprites for something else.
!

...
Not quite true. You can use sprites for both gameplay and text by moving the text away from where your regular sprites are stored. Just wanted to make this clear.
What I mean is... There are 512 available slots for sprites and as you said, there could be some sprites already used for enemies or the player itself, a few slots became used. What you mean is (i guess)... You can think about you need up to 256 slots for example just for gameplay elements and after slot 256, you can use 255 character sprites to make text out of them. That's what I meant with
the spoiler"Even less (than 512) if you use sprites for something else.
!
You can edit the sprite definition in real time. You don't need to use a sprite for every single character in your text! How to make a sprite from text! - chicken

You can edit the sprite definition in real time. You don't need to use a sprite for every single character in your text!
But what about 32x32 or 16x16 bitmapped characters to form text. LinkZ19's ClockZ has a 8x16 font (A-Z) hidden in it's sprite sheet. My upcoming game will use 8x8, 16x16 and 32x32 fonts for various interfaces. EDIT: If a size of one character like "i" should be different such font sets are better, as they do not need much programming to accomplish drawing them.
"You could do that with that technique"
'---
SPPAGE 4
GPAGE 0,4
S$="Nice day!"
X=90Y=66
FOR I=0 TO LEN(S$)-1
GPUTCHR X,Y,MID$(S$,I,1)
IF MID$(S$,I,1)=="i" THEN INC X,4
... 'if needed, more of them!
ELSE INC X,8
ENDIF
...
NEXT
'---
another benefitUnlike normal text, sprites used for text can change their color, their position, like when a person yells at someone, or become squished or streched on the fly. SPANIM can be used, for example, to automatically change colors. This can be used for ... a "CONGRATULATIONS!" string or so. My game will make use of it.
SpoilerMaybe I should create a page "Make text out of sprites" for skilled programmers...

Umm... Thanks guys..? 😂 I figured out it was just an error of where I put that loop... So yeah...

MID$(S$,I,1) can be written as S$[I].

MID$(S$,I,1) can be written as S$[I].
Thanks!
¿Never knew that string variables can be handled as sort of arrays.
AlthoughIt might take a few spoilers! XD
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
Spoiler
SpoilerSorry about that. lol
SpoilerAlthough I know that character strings or such variables are sort of arrays storing each character's ID...