keyboard_string

Holds a string of the last keys pressed.

Syntax:

GML Code Example

keyboard_string;


Returns: String


Description

This variable holds a string containing the last (at most) 1024 characters typed on the keyboard. This string will only contain printable characters typed, but it will correctly respond to pressing the backpsace key by erasing the last character. This variable is not read only and you can change it, for example to set it to "" (an empty string) if you handled it already, or use the String Functions to manipulate it.


Example:

GML Code Example

if string_length(keyboard_string) > 15
    {
    keyboard_string = string_copy(keyboard_string, 1, 15);
    }
 

The above code will limit the length of the keyboard string to 15 characters, removing those that are over that limit by copying the first fifteen characters back into the variable.





No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here