String char at

Explanation
This string function returns the character from str at position index. The first position has an index of 1. When the index is 0 or negative the first character is returned. When the index is larger than the length of the string an empty string is returned.

Example
The following piece of code shows how to use string_char_at to get the third character in the string of "Hello".

var returned_char; returned_char = string_char_at("Hello",3); return returned_char;

This is very useful for creating a simple dialogue script (with a typewriter effect), as shown in the example below.

// Declare the variables to be used in this example code var text,new_text,position; // This variable, "text", is the string that will get typed out text = "Place a message here."; // This variable, "new_text", is the variable that will store the typed out string new_text = ""; // This code will scroll through the string "text" while the variable "position" // is less than or equal to the amount of characters in "text". for (position = 1; position <= string_length(text); position += 1) {     // Add the character in the variable texting at the position of "position" to "new_text" new_text += string_char_at(text,position); // Draw the variable "new_text" to the screen draw_text(0,0,new_text); // Refresh the screen with the text drawn above screen_refresh;  //Pause the game for 50 milliseconds so that way you can watch the letters type onto the screen sleep(50); }

You might want to play a click sound before calling the sleep function