diff --git a/automated_updates_data.json b/automated_updates_data.json index 707ca2a1fb..e01bb0838c 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-07", + "summary": "Improved string-instructions doc with missing StrReplaceAll/StrReplaceOne functions; improved player-authentication doc with missing UserID expression and Hide banner action" } ] } diff --git a/docs/gdevelop5/all-features/player-authentication/index.md b/docs/gdevelop5/all-features/player-authentication/index.md index 4390cfd406..268d93e852 100644 --- a/docs/gdevelop5/all-features/player-authentication/index.md +++ b/docs/gdevelop5/all-features/player-authentication/index.md @@ -30,6 +30,8 @@ You can use the action **"Display authentication banner"**. For example, this ca We recommend showing the banner again if the user goes back to the main menu, or display a button to log in (see the next section). +Use the action **"Hide authentication banner"** to programmatically remove the banner — for example, once the player has logged in or during a cutscene where the banner would be distracting. + ## Open an authentication window The authentication window opens up when the player clicks on the banner, but if you want to handle the opening of the window yourself, you can use the action **"Open an authentication window"**. This is perfect if you prefer to have a "Login" or "Connect" button in your game. It's also useful if you want to ensure your players log in before playing. @@ -57,15 +59,19 @@ This is particularly useful to implement to handle when a player logs in to a di If you'd like to retrieve the username of the connected player, to name a character in your game, or adapt your messages to be more personalized, you can use the expression `PlayerAuthentication::Username()`. -## Log out the player +## Get a player's unique ID -If needed, an action is available to log out the player from the game, you can use the action **"Log out player"**. +Each player account has a stable **unique user ID** that never changes, even if the player updates their username. Use the expression `PlayerAuthentication::UserID()` to retrieve it. -## Other features +This ID is useful for: -!!! note +- Saving player-specific data server-side and being able to retrieve it for the same player across sessions. +- Associating leaderboard scores with a specific player account. +- Any scenario where you need a permanent, unchanging identifier rather than a display name. - Player accounts is still experimental and new features will quickly be added to find the player unique identifier, store progress, saves or items, and more! +## Log out the player + +If needed, an action is available to log out the player from the game, you can use the action **"Log out player"**. ## Reference diff --git a/docs/gdevelop5/all-features/string-instructions/index.md b/docs/gdevelop5/all-features/string-instructions/index.md index 8fc2d75993..28b655ba52 100644 --- a/docs/gdevelop5/all-features/string-instructions/index.md +++ b/docs/gdevelop5/all-features/string-instructions/index.md @@ -63,4 +63,23 @@ If the string does not exist, -1 will be returned. In this expression, the string entered is searched in the text in the backward direction but rather than starting from the end, it starts from the position entered. This will give us the position of the last occurrence of the string in the text considered for search. -If the string does not exist, -1 will be returned. \ No newline at end of file +If the string does not exist, -1 will be returned. + +## Replace text + +Two expressions are available to replace parts of a string: + +- **Replace all occurrences** (`StrReplaceAll`): replaces every occurrence of the search text with a replacement. For example, `StrReplaceAll("hello world world", "world", "there")` returns `"hello there there"`. +- **Replace first occurrence** (`StrReplaceOne`): replaces only the first occurrence of the search text. For example, `StrReplaceOne("hello world world", "world", "there")` returns `"hello there world"`. + +Both expressions are case-sensitive. If the search text is not found, the original text is returned unchanged. + +!!! tip + + `StrReplaceAll` is useful for formatting template strings. For example, you can store a template like `"Score: SCORE points"` in a variable and substitute the placeholder at display time: + + `StrReplaceAll("Score: SCORE points", "SCORE", ToString(Variable(PlayerScore)))` + +## Reference + +All actions, conditions and expressions are listed in the [text manipulation reference page](/gdevelop5/all-features/string-instructions/reference/). \ No newline at end of file