Quick answer: GameMaker keyboard_string retains text typed for a previous field when you open a new one? It’s a global text buffer; you must clear it manually.

Closing a name-entry dialog and opening a chat dialog later starts with the name pre-filled in the chat. keyboard_string wasn’t cleared between dialogs.

Clear on Open

keyboard_string = "";
keyboard_lastchar = "";

Reset both before showing each text-entry field. Clean state every time.

Backspace Behavior

keyboard_string supports backspace naturally; arrow keys do not. For a full text editor, you handle keyboard_lastkey yourself.

Async Keyboard for Mobile

On mobile, prefer the async keyboard event (keyboard_virtual_show). Returns a separate text field via async events — doesn’t pollute keyboard_string.

Verifying

Each dialog starts with empty input. Typing populates correctly; opening a new dialog clears.

“keyboard_string is global. Clear it when opening a new input field.”

Wrap text-input dialogs in a struct that owns its buffer and reads from keyboard_string each step — one clear point per dialog lifecycle.