The following code will enable you to draw text on the screen one letter at a time. This is accomplished by having two strings- one that contains all the text, and another that only contains the text that is drawn to the screen. The original string is read, letter by letter, and copied to the second string. If certain characters are read, the system can take special action, such as making dramatic pauses, erasing the copy string (to move to the next text 'section'), and breaking lines.
CREATE:
draw_set_font(font0)
//& = pause
//~ = next text set
string_dum=
"
You can die too for all I care!~
AS... YOU... WISH! ~
Oh, my sweet Westley!##What have I done?~
"
timer=0 //measures amount of time between typing each letter
add_index=0 //the index of the current letter being added to the drawn string
string_line="" //the string being drawn
f="" //the actual letter being added
line_timer=0 //pause for moving to new text set
pause_timer=0 //pause for punctuation
STEP
timer+=1
if timer=2
timer=0
if timer=0
and pause_timer<=0
and line_timer<=0
{
f=string_char_at(string_dum,add_index)
if f="&"
{
pause_timer=20
}
else if f="~"
{
line_timer=50
timer=0
add_index+=1
}
else
{
if add_index>0
string_line=string_insert(f,string_line,add_index+1)
}
if f="." or f="!" or f="?"
pause_timer=15
if f=","
pause_timer=10
add_index+=1
}
pause_timer-=1
line_timer-=1
if line_timer=1
string_line=""
DRAW
draw_text(x,y,string_line)