Archive.png This article or section documents something not included in the current version of Scratch (3.0). It is only useful from a historical perspective. For information on the feature that replaced this one, see Username (block).
User ID
(user id :: sensing)
Category Sensing
Type Reporter
Introduced in 2.0 alpha
Removed in 2.0 beta

The user id block was a sensing block and a reporter block. It reported a number unique to each user that viewed a project. It was removed in the Scratch 2.0 public beta in favor of the username block. Some Scratchers have requested for this block to be re-added.[1]

Function

Each user had a different ID according to when they viewed the project (the first viewer was 1, the second was 2, and so forth). Users who were not logged in to an account were assigned the user ID 0. A user's ID remained constant for the same project and would not change.

Workaround

Main article: List of Block Workarounds#Removed Blocks


This block can be replicated with the following code:

when [timer v] > (((1)/(0))*(-1))
if <not<[☁ users v] contains (username)>> then
if <not<(username)=()>> then
add (username) to [☁ users v]
end
end
set [user id v] to (item # of (username) in [☁ users v])
Note Note: This workaround requires cloud lists, which are no longer included in Scratch. But they can be replicated by encoding and decoding cloud data

See Also

References

Cookies help us deliver our services. By using our services, you agree to our use of cookies.