Enters keyboard input into the given string. The local
keyboard layout is activated.
inchar() waits until a key is pressed, reads it into the string, and returns its ASCII value; inkey() reads characters into the string until the input is terminated with [Enter] or [Tab].
STRING* - String pointer to receive keyboard
entry, or NULL for just returning the key value.
||Input terminated prematurely because inkey_active was set to 0 or
another keyboard entry was active at the same time.
||Input terminated by [Tab]
||Input terminated by [Enter]
||Input aborted by [Esc]
||Input aborted by [Up]
||Input aborted by [PgUp]
||Input aborted by [Down]
||Input aborted by [PgDn]
||ASCII value of the pressed key.
||String receives keyboard entry.
||Set to 1 (inkey) or 2 (inchar) during entry.
of the inkey() input can be edited during entry using the [BackSpace], [Del], [Right], [Left], [Home] and [End] keys. The original length of the string is not exceeded. Pressing [Esc], [Up], [Down], [PgUp], [PgDn] or [F1]..[F11] aborts inkey(); the previous content of the string is then restored, and the scan code of the key is returned.
- If the string appears in a TEXT object displayed on screen, the input as well as a cursor are visible. The cursor is the character 127 from a bitmap font, or the character 59 (underscore '_') from a TrueType font. The str_cursor function can be used to get the current cursor position while the string is edited.
- Keyboard entry can be aborted externally by setting the inkey_active variable
Key events (on_a etc.) are inactive during keyboard
entry, and game_save/game_load functions are not executed.
The functions perform internal wait() calls and thus can not be used by external languages. They are not exported in acknex.dll.
STRING* entry_str = " "; // long empty string
var key = inkey(entry_str); // wait until [enter] pressed
if (key == 13)
STRING* string1 = "";
STRING* string2 = "";
if (inchar(string1) == 13) break;
inkey_active, str_cursor, key_a,...,key_z,