(Current Status: Clarifying whether the variable can store numbers smaller than 10,240, or smaller than 10,240 digits.)
Line 13: Line 13:
 
Cloud data may not be used by [[New Scratcher Status|New Scratchers]]. The Scratch Team does not want people new to Scratch crashing the server or taking up space because they may not know what they are doing.{{citation needed}}
 
Cloud data may not be used by [[New Scratcher Status|New Scratchers]]. The Scratch Team does not want people new to Scratch crashing the server or taking up space because they may not know what they are doing.{{citation needed}}
  
Since Cloud Data is stored on the server, cloud variables cannot be used in the offline editor.
+
Since Cloud Data is stored on the server, cloud variables cannot be used in the [[Scratch 2.0 Offline Editor|offline editor]].
  
 
== Current Status ==
 
== Current Status ==

Revision as of 01:20, 7 December 2014

Clock.png This article or section contains information about a feature from a future version of Scratch that is unreleased and is subject to change. Please cite any additional info in order to prevent speculation.
The process to create a cloud variable in Scratch 2.0 is much the same as creating a regular variable; the only difference is checking the "cloud variable" box.

Cloud data is a new feature that allows users to store variables and lists "in the cloud", or on the server. Cloud variables and lists have the character "☁" (a cloud icon in the font Scratch uses) in front of them, to distinguish from regular variables:[1]

Cloud-icon.png

They update automatically, as opposed to requiring refreshing before updating. They do not refresh instantly, however; they lag about 2 seconds between updates.

Cloud variables and lists use the regular blocks associated with the data types. The only difference is that the value is truly global, and is reflected across all copies of the project being viewed on the Scratch Website.

Cloud data is referred to as "persistent" in the code and some early development versions.

Cloud data may not be used by New Scratchers. The Scratch Team does not want people new to Scratch crashing the server or taking up space because they may not know what they are doing.[citation needed]

Since Cloud Data is stored on the server, cloud variables cannot be used in the offline editor.

Current Status

Currently, cloud data has been stripped down to only (up to 10) cloud variables that can contain only integers, meaning that cloud variables, unlike regular variables, CANNOT contain letters. A character limit of 10,240 digits per variable has also been implemented, which translates to 102.4 KB of cloud data storage per project. The Scratch Team says they want to configure the server bit-by-bit to add new features incrementally.[2]

Though this limits the kinds of projects that can be made, one can still make a reasonable variety of projects that have interaction with an arbitrary number of computers.

Example Uses

  • High score lists
  • Surveys
ask [Vote for Pepsi or Coke! Which is your favorite?] and wait
if <(answer) = [Pepsi]> then
  change [☁ pepsi votes v] by (1)
else
  if <(answer) = [Coke]> then
    change [☁ coke votes v] by (1)
  else
    say [Sorry! That answer wasn't recognized.]
end

Cloud Log

When the Scratch Team released the beta version of cloud data, they set up public logs for projects with cloud data in them showing the time cloud data was modified, who modified the data, the current value of the data, and the type of action of the data modification (such as del_var, rename_var, and set_var).

Cloud Data log.png

Sharing Broadcasts

Cloud data is similar to Mesh. Both features allow sharing of variables across projects. By using variables, cloud data can also simulate broadcasts across projects, as shown in the scripts below:

when gf clicked
set [old broadcast v] to (☁ broadcast)
forever
 if <not <(old broadcast) = (☁ broadcast)>>
  broadcast [cross-project message v]
 set [old broadcast v] to (☁ broadcast)

when I receive [cross-project message v]
. . . // category=grey
when key [space v] pressed //This script will "broadcast"
set [☁ broadcast v] to [new message]
An optimized version would replace
broadcast [cross-project message v]
for
broadcast (☁ broadcast)
with a When I Receive block for each possible broadcast.

See Also

References

  1. https://scratcharchive.asun.co/forums/viewtopic.php?pid=1127806#p1127806
  2. http://scratch.mit.edu/help/faq/#clouddata