String copy

Explanation
This string function returns a substring from str starting at position index, with length count. The first position has an index of 1. When count is larger than the length of the string only the part until the end is returned.

Examples
var text1, text2; text1 = string_copy("ABCDEFGHIJKLMNOPQRSTUVWXYZ",1,7); text2 = string_copy("ABCDEFGHIJKLMNOPQRSTUVWXYZ",22,7);

Returns in text1 the string "ABCDEFG" and in text2 the string "VWXYZ".

The following example shows a messages that is "typed" on the screen, one character at a time.

// Declare all variables to be used var text,new_text,position; // Initialize all variables to be used  // This variable, "text", will be the string you want to have typed text = "Insert message here"; // The new string that will hold the value of the typed string new_text = ""; //Scroll through the string of the variable "text" for (position = 1; position <= string_length(text); position += 1;) {    // Set the variable "new_text" to include all characters in "text" up until "position" new_text = string_copy(text,1,position); // Draw "new_text" to the screen draw_text(0,0,new_text); // Refresh the screen with the drawn text screen_refresh; // Pause for 50 milliseconds so the typing effect is visible sleep(50); }

You might want to add a tick sound after each character is added (before the sleep function).