Note: The code below is part of a bigger code. I'm just posting it to give you an idea of how I simulate the type-writer style dialog box. It works in my game, but may NOT work if copy-pasted.
//===============================================================
// Window Text
// --------------------------------------------------------------
// Draws a string on the screen.
// ==============================================================
txx = argument0; //Text x position;
txy = argument1; //Text y position;
tsp = argument2; //Text speed. 0-1, -1 to have text appear at once;
tst = argument3; //Text string;
//Make temporary variables.
var oldcol,oldalp,pos,strl,n; //Old color, Old font, position, string length;
strl = string_length(tst); //Store the text's length.
pos =1; //Position variable.
charpartx = 1; //Additional space between the letters.
charparty = 1; //Additional space between the lines.
// charpartx/y variables are multiplied by the current character's
// (letter's) width/height.
// --------------------------------------------------------------
// Drawing the text ->
//-> To draw the text we start a loop. In the loop, we check the
// character at the current pos(ition) and draw it, refreshing
// the screen and sleeping as we go.
// --------------------------------------------------------------
io_clear(); //Clear keyboard and mouse status.
n = 1;
while (n == 1)
{
for (i=0;i<strl;i+=1)
{
//If a color tag is found:
if (string_char_at(tst,pos) == '[' && string_char_at(tst,pos-1) != '\')
{
draw_set_color(c_aqua);
pos+=1;
}
if (string_char_at(tst,pos) == ']' && string_char_at(tst,pos-1) != '\')
{
draw_set_color(c_white);
pos+=1;
}
//If a new line tag is found...
if (string_char_at(tst,pos) == '#' && string_char_at(tst,pos-1)!= '\')
{
txx = argument0; //->Jump back to the beginning of the line.
txy+=string_height(string_char_at(tst,pos))*charparty; //Go down to a new line.
pos+=1; //Move forward one position without
} //drawing the symbol.
//If a "/" symbol is found...
if (string_char_at(tst,pos) == '\')
{
txx +=1;
}
draw_text(txx,txy,string_char_at(tst,pos)); //Draw the character found at pos.
txx+=string_width(string_char_at(tst,pos))*charpartx; //Move over a bit for the next char.
screen_refresh(); //Refresh the screen.
if (tsp > 0) //If text speed is greater than 0
sleep(40*tsp); //sleep for a bit.
pos += 1; //Add one to the position.
//-------------------------------------------------------
//If the end of the string is reached.
//-------------------------------------------------------
if (pos >= strl)
{
io_handle(); //Update keyboard/mouse status.
screen_refresh(); //Refresh the screen.
if (keyboard_check(ord('Z'))) {n = 0; break;} //Check for Z key, and break if pressed.
if (keyboard_check(vk_escape)){n = 0; break;} //Check for escape key.
if (!keyboard_check(ord('Z'))) n=1; //Else, keep drawing the text.
}
}
}
What it's basically doing, is drawing one letter at a time, instead of drawing a copy of the whole string (as you were doing). Because of this, I can control each letter in the string as I want. I.E, I can change each letter's size, color, font, etc.
Once it reaches the end of the string (pos(ition) > string_length), it waits until the user presses a key, and then breaks out of the loop.