(Redirected from (Username))
The Username block is a sensing block and a reporter block. It reports the username of the user viewing the project, which can be used for saving progress in a project, either with a variable encoder or cloud lists (once they are released with string-storage capabilities), as well as other purposes. If no user is signed in, this block returns the empty string.
Originally, the Scratch Team was reluctant to add this block because it could compromise users' privacy. They started with the User ID block, which gave an anonymous but effective way of recognizing users for a specific project. However, they eventually decided to replace it with this block because it is easier for beginners to understand and was so frequently requested.
As a safety measure, all projects that sense your username have warnings attached. If one wants to be anonymous, log out before viewing the project. Alongside, the warning appears if the backpack had a script with the username block, no matter if the project had a username block or not.
- Saying hi to the user viewing the project
say (join [Hi, ] (username))
- Checking if the user has visited before, using Cloud Data
|Note:||Cloud lists have not come out yet, so you would have to make your own cloud list.|
if <not <[☁ visitors v] contains (username)>> then add (username) to [☁ visitors v] else say [Welcome back again!] end
- Checking if the viewer is logged in
when gf clicked if <(username) = > then//a logged off user reports a blank response say [Hi new user!] for (2) secs
- Creating a high score list
- An "admin" list in a safe chat
when gf clicked if <[admins v] contains (username)?> then//The "admins" list will likely have the project owner, all of their alternate accounts, and possibly all Scratch Team members broadcast [admin v]
- User ID — this block's predecessor