Fill an input or press a key
interactSet a value on a Twine input, textarea, select, radio, or checkbox by ref, or press a keyboard key, then get the updated observation.
Instructions
Interact with input fields or the keyboard: set a value on an input/textarea/select by ref, or press a key (e.g. "Enter", "ArrowUp"). For radios/checkboxes pass value "true" or "false". Inputs are refs from the last observation (or find_ui). Returns the new observation; pass format:"json" for a JSON string.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | No | Keyboard key to press, e.g. "Enter", "a", "ArrowDown". | |
| ref | No | Input ref from the last observation (e.g. "i1"). Optional when only pressing a key. | |
| value | No | Value to set on the input/select. Radios/checkboxes: "true" or "false". | |
| format | No | Output format: "text" (default, human-readable) or "json" (JSON string for programmatic use). | |
| game_id | Yes | Session id returned by open_game. |