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 | v132[citation needed] (2.0 alpha) |
Removed in | v252 (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.
Later versions
When importing the block into Scratch 3.0, the block does not appear to return anything. However, when it is inside of a join block, the join block reports as undefined.
Workaround
- Main article: List of Block Workarounds#Removed Blocks
This block can be replicated with the following code:
when [timer v] > ((-1)/(0)) 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: | This workaround requires cloud lists, these are not included in Scratch and are a rejected feature. But they can be replicated by encoding and decoding cloud data |