diff --git a/automated_updates_data.json b/automated_updates_data.json index 707ca2a1fb..cc56e43caf 100644 --- a/automated_updates_data.json +++ b/automated_updates_data.json @@ -68,6 +68,10 @@ { "date": "2026-03-05", "summary": "Improved network docs: updated to async single-URL API, added HTTP methods, error variable, CORS warning, content type info, and Open URL action" + }, + { + "date": "2026-03-09", + "summary": "Improved keyboard docs with missing 'Key just pressed' and 'Any key released' conditions, touch device warning, and full key names reference table; improved common-conversions docs with LargeNumberToString and JSON variable conversion features" } ] } diff --git a/docs/gdevelop5/all-features/common-conversions/index.md b/docs/gdevelop5/all-features/common-conversions/index.md index 54cb2a90ec..82f7e4cdcd 100644 --- a/docs/gdevelop5/all-features/common-conversions/index.md +++ b/docs/gdevelop5/all-features/common-conversions/index.md @@ -3,7 +3,7 @@ title: Common conversions --- # Common conversions -This category helps the user to do angle conversions and number to/from text conversions. +This category provides expressions and actions to convert between numbers and text, convert angles, and convert variables to and from JSON. ## Angle conversion @@ -26,6 +26,32 @@ To input a string in a numerical expression, you can convert it to number using To input a number in string expression, you can use the "Number > Text" expression. If the number used is greater than or equal to 1e+21, the expression returns its value in scientific notation. +To avoid scientific notation for very large numbers, use the **"Number > Text (without scientific notation)"** expression instead. For example, `LargeNumberToString(1234567890123)` returns `"1234567890123"` rather than `"1.234567890123e+12"`. + +## Variable to/from JSON + +Variables (including structures and arrays) can be serialized to a JSON string and parsed back. This is useful for sending data over the network, storing complex data with [storage actions](/gdevelop5/all-features/storage), or debugging variable content. + +### Convert a variable to JSON + +Use the **"Convert variable to JSON"** expression (`ToJSON`) to turn any scene or global variable into a JSON string: + +``` +ToJSON(MyVariable) +``` + +To convert an **object variable** to JSON, use the **"Convert object variable to JSON"** expression (`ObjectVarToJSON`): + +``` +ObjectVarToJSON(MyObject, MyObject.SomeVar) +``` + +### Convert JSON to a variable + +Use the action **"Convert JSON to a variable"** to parse a JSON string and store the result into a scene, global, or local variable. This is the inverse of `ToJSON` and allows reading back data that was previously serialized. + +To parse JSON directly into an **object variable**, use the **"Convert JSON to object variable"** action instead. + ## Reference -All actions, conditions and expressions are listed in [conversions reference page](/gdevelop5/all-features/common-conversions/reference/). \ No newline at end of file +All actions, conditions and expressions are listed in [conversions reference page](/gdevelop5/all-features/common-conversions/reference/). diff --git a/docs/gdevelop5/all-features/keyboard/index.md b/docs/gdevelop5/all-features/keyboard/index.md index a939ed6bcb..e4ae465875 100644 --- a/docs/gdevelop5/all-features/keyboard/index.md +++ b/docs/gdevelop5/all-features/keyboard/index.md @@ -3,23 +3,35 @@ title: Keyboard --- # Keyboard -GDevelop gives access to all inputs made on the keyboard. This includes conditions to check if a key was pressed or released. +GDevelop gives access to all inputs made on the keyboard. This includes conditions to check if a key is held down, just pressed, or released. + +!!! warning + + Keyboard conditions do **not** work with on-screen virtual keyboards on touch devices. For mobile or touchscreen games, use [mouse/touch conditions](/gdevelop5/all-features/mouse-touch) instead. ## Any key pressed -For this condition, the corresponding action/s will be performed if any key on the keyboard is pressed. +This condition is true as long as **any** key on the keyboard is held down. + +## Any key released + +This condition is true for one frame when **any** key is released. ## Key pressed -Whenever the key selected while setting this condition is pressed, the corresponding actions are performed. +This condition is true as long as the selected key is **held down**. Use this for continuous input such as moving a character while a direction key is held. + +## Key just pressed + +This condition is true for **one frame only** — the frame when the key is first pressed. Use this for single-trigger actions such as jumping, firing, or opening a menu, where you want the action to happen once per key press and not repeat while the key is held. ## Key released -Whenever the key selected while setting this condition is released, the corresponding actions are performed. +This condition is true for one frame when the selected key is **released**. ## Key pressed (text expression) -To test a key press using this condition, you need to enter the key name in the form of text expression. For example, if you want to check condition for left arrow key press, you need to enter "Left" in the field. +To test a key press using this condition, enter the key name as a text expression. For example, to check if the left arrow key is pressed, enter `"Left"` in the field. !!! danger @@ -29,14 +41,34 @@ To test a key press using this condition, you need to enter the key name in the ## Key released (text expression) -To test a key release using this condition, you need to enter the key name in the form of text expression. For example, if you want to check condition for left arrow key release, you need to enter "Left" in the field. +To test a key release using this condition, enter the key name as a text expression. For example, to check if the left arrow key is released, enter `"Left"` in the field. ![](/gdevelop5/all-features/annotation_2019-06-20_191302.png) ## Last key pressed -"Last key pressed" expression returns the last key press in the form of a string. For example, if the last key press is the left arrow key, the expression will return "Left". +The "Last key pressed" expression returns the name of the most recently pressed key as a string. For example, if the left arrow key was last pressed, the expression returns `"Left"`. + +## Key names reference + +The following key names can be used in the text-expression versions of keyboard conditions: + +| Category | Key names | +|---|---| +| Letters | `a` – `z` (lowercase) | +| Number row | `Num0` – `Num9` | +| Numpad digits | `Numpad0` – `Numpad9` | +| Arrow keys | `Left`, `Right`, `Up`, `Down` | +| Numpad arrows | `NumpadLeft`, `NumpadRight`, `NumpadUp`, `NumpadDown` | +| Function keys | `F1` – `F12` | +| Modifiers | `LShift`, `RShift`, `LControl`, `RControl`, `LAlt`, `RAlt` | +| Special | `Space`, `Return`, `Escape`, `Tab`, `Back`, `Delete`, `Insert` | +| Navigation | `Home`, `End`, `PageUp`, `PageDown` | +| Numpad navigation | `NumpadHome`, `NumpadEnd`, `NumpadPageUp`, `NumpadPageDown`, `NumpadReturn` | +| Numpad operators | `Add`, `Subtract`, `Multiply`, `Divide`, `NumpadAdd`, `NumpadSubtract`, `NumpadMultiply`, `NumpadDivide` | +| Punctuation | `SemiColon`, `Comma`, `Period`, `Quote`, `Slash`, `BackSlash`, `Equal`, `Dash`, `LBracket`, `RBracket`, `Tilde` | +| Other | `Pause`, `Menu`, `LSystem`, `RSystem` | ## Reference -All actions, conditions and expressions are listed in [the keyboard reference page](/gdevelop5/all-features/keyboard/reference/). \ No newline at end of file +All actions, conditions and expressions are listed in [the keyboard reference page](/gdevelop5/all-features/keyboard/reference/).