LoginLogin

Auto Print Text On Screen

Root / Submissions / [.]

AlicekittyCreated:
This is how to make a function that prints text out on the screen one character at a time. Normal Auto Text Function
DEF AUTOTEXT X,Y,TXT$
FOR I=0 TO LEN(TXT$)-1
GPUTCHR X+I*6,Y,TXT$[I],1,1
VSYNC 3 'Speed of the text 
NEXT
END
Auto Text Function with speed option
DEF AUTOTEXT X,Y,TXT$,SPEED
FOR I=0 TO LEN(TXT$)-1
GPUTCHR X+I*6,Y,TXT$[I],1,1
VSYNC SPEED
NEXT
END
I don't know if this would be useful for anyone but I figured I would show it anyway in case someone needed something like this. :-)

I've used code similar to that and now i use it for most of my games. Its a nice touch for dialogue text.

Replying to:Arkzen
I've used code similar to that and now i use it for most of my games. Its a nice touch for dialogue text.
Wow really? that's cool! I agree with you on that one! :-)

yeah the one i use is more text based so this will probably help with getting those annoying positions lol

Problem is when you have other process in the background. The dialogue, at least as written here, will affect the flow of EVERYTHING. To avoid such behavior, an idea i had was to keep track of what character is showing and what is the next character to show on a certain time. Something like this, is not good but to give you an idea:
 DEF Dialogue_Text Text$,POS,TIME OUT NewTIME, NEWPOS
  IF !TIME THEN 'if time has passed and it's 0, show a character
   ? Text$[POS]
   IF LEN(Text$)-1 (bigger than) POS THEN NEWPOS=LEN(Text$)POS+1
   NewTIME=15
  ELSE
   NewTIME=TIME-1
  ENDIF
 END

Replying to:Autz64
Problem is when you have other process in the background. The dialogue, at least as written here, will affect the flow of EVERYTHING. To avoid such behavior, an idea i had was to keep track of what character is showing and what is the next character to show on a certain time. Something like this, is not good but to give you an idea:
 DEF Dialogue_Text Text$,POS,TIME OUT NewTIME, NEWPOS
  IF !TIME THEN 'if time has passed and it's 0, show a character
   ? Text$[POS]
   IF LEN(Text$)-1 (bigger than) POS THEN NEWPOS=LEN(Text$)POS+1
   NewTIME=15
  ELSE
   NewTIME=TIME-1
  ENDIF
 END
Ah! I hadn't thought of this thank you very much! :-)