keyboard_string

Holds a string of the last keys pressed.

Syntax:

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 backspace 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:

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.


Back: Keyboard Input
Next: keyboard_set_map
© Copyright YoYo Games Ltd. 2017 All Rights Reserved