Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » How to Make a Cloud Var Watcher?
- space_elephant
-
500+ posts
How to Make a Cloud Var Watcher?
How do I simulate a cloud var watcher?
EDIT: many have been confused about what I mean so:
I can do

the only thing that I need help for is

Also the I can do that last one without the slider.
EDIT: many have been confused about what I mean so:
I can do
set[☁ cloud variable v]to[0]and I can also do
change[☁ cloud variable v]by(1)
(☁ cloud variable)

the only thing that I need help for is

Also the I can do that last one without the slider.
Last edited by space_elephant (Oct. 13, 2018 16:16:14)
- Garamol56
-
100+ posts
How to Make a Cloud Var Watcher?
What do you mean by watcher? Like something that detects when they change?
- ninjagolloyd
-
500+ posts
How to Make a Cloud Var Watcher?
Do you mean an API that tells you when a cloud var changes? How do I simulate a cloud var watcher?
I know how to do blocks but not watchers.
you should be able to, as long as your programming language has web requests
- space_elephant
-
500+ posts
How to Make a Cloud Var Watcher?
I mean these: What do you mean by watcher? Like something that detects when they change?
(12::variables)I can do these
(☁ score(12::variables)::grey)
☁ score(12::variables)::grey hat
------+-----------------::grey cap
(☁ score)
set[☁ score v]to[0]
change[☁ score v]by(1)
- Jonathan50
-
1000+ posts
How to Make a Cloud Var Watcher?
It should appear on the stage once you make a cloud variable. You can toggle it with the checkbpx next to the variable in the palette.
- space_elephant
-
500+ posts
How to Make a Cloud Var Watcher?
checkbpxcheckbox next to the variable in the palette.I mean like another program, not scratch, using a cloud var watcher. It should appear on the stage once you make a cloud variable. You can toggle it with the
- Jonathan50
-
1000+ posts
How to Make a Cloud Var Watcher?
Oh, okay, sorry. Then you will have to write code to draw the watcher, using whatever graphics library you use (if that's what you want.) I mean like another program, not scratch, using a cloud var watcher.
Last edited by Jonathan50 (Oct. 3, 2018 21:33:17)
- ninjagolloyd
-
500+ posts
How to Make a Cloud Var Watcher?
can you specify which program???checkbpxcheckbox next to the variable in the palette.I mean like another program, not scratch, using a cloud var watcher. It should appear on the stage once you make a cloud variable. You can toggle it with the
i doubt you can do it in a blocks environment
- Wettining
-
500+ posts
How to Make a Cloud Var Watcher?
Do you mean something like the ScratchAPI that will get your cloud variables from an external client?
- space_elephant
-
500+ posts
How to Make a Cloud Var Watcher?
I don't care about the drawing it. I mean the API.Oh, okay, sorry. Then you will have to write code to draw the watcher, using whatever graphics library you use (if that's what you want.) I mean like another program, not scratch, using a cloud var watcher.
- space_elephant
-
500+ posts
How to Make a Cloud Var Watcher?
ScratchAPI that will get your cloud variables from an external client?In C++ but yes kind of Do you mean something like the
- Jonathan50
-
1000+ posts
How to Make a Cloud Var Watcher?
What do you want? Are you already able to read cloud variables? I don't care about the drawing it. I mean the API.
- jokebookservice1
-
1000+ posts
How to Make a Cloud Var Watcher?
Scratch uses WebSockets (RFC6455) for it's Cloud Data API. You want to open a connection to
For security, you'll need to send an Origin: header of scratch.mit.edu, and be logged in (i.e., have your Cookie: header set)
Basic Structure
All data is sent backwards and forwards as JSON objects. Here are the properties that all such objects will have
In addition, client-to-server objects must have an additional property that server-to-client messages don't need.
Setting data
On top of the basic structure, you also need to send the following to set a cloud variable to a specific value. The “method” property should be set to “set”.
Getting data
The server will send you the same data as in Setting data if the value of a cloud variable changes (and you weren't the person who set it). It'll still be the “set” method, but note that the “user” parameter will not be given to you (that's only given on client-to-server data)
Example
Here's a generic example of what a connection might look like:
wss://clouddata.scratch.mit.edu
For security, you'll need to send an Origin: header of scratch.mit.edu, and be logged in (i.e., have your Cookie: header set)
Basic Structure
All data is sent backwards and forwards as JSON objects. Here are the properties that all such objects will have
- method (string) - the action that this object represents
- project_id (string) - the numeric ID (as seen in the URL bar) of the project in question. Note that this value is a string.
In addition, client-to-server objects must have an additional property that server-to-client messages don't need.
- user (string) - your username
Setting data
On top of the basic structure, you also need to send the following to set a cloud variable to a specific value. The “method” property should be set to “set”.
- name (string) - the name of the cloud variable, including the cloud symbol
- value (string) - the value of the cloud variable - always a string
Getting data
The server will send you the same data as in Setting data if the value of a cloud variable changes (and you weren't the person who set it). It'll still be the “set” method, but note that the “user” parameter will not be given to you (that's only given on client-to-server data)
Example
Here's a generic example of what a connection might look like:
- Client connects to clouddata.scratch.mit.edu
- Client sends handshake
{ "user": "exampleuser", "project_id": "1234567", "method": "handshake" }
- Server tells client what the current value of the cloud variable is
{ "project_id": "1234567", "method": "set", "name": "☁ counter", "value": "12" }
- Client tells server about a change to the cloud variable
{ "user": "exampleuser", "project_id": "1234567", "method": "set", "name": "☁ counter", "value": "13" }
- space_elephant
-
500+ posts
How to Make a Cloud Var Watcher?
RFC6455) for it's Cloud Data API. You want to open a connection toBut how does the slider work? And how do I know who changed it? Scratch uses WebSockets (wss://clouddata.scratch.mit.edu
For security, you'll need to send an Origin: header of scratch.mit.edu, and be logged in (i.e., have your Cookie: header set)
Basic Structure
All data is sent backwards and forwards as JSON objects. Here are the properties that all such objects will have
- method (string) - the action that this object represents
- project_id (string) - the numeric ID (as seen in the URL bar) of the project in question. Note that this value is a string.
In addition, client-to-server objects must have an additional property that server-to-client messages don't need.
- user (string) - your username
Setting data
On top of the basic structure, you also need to send the following to set a cloud variable to a specific value. The “method” property should be set to “set”.
- name (string) - the name of the cloud variable, including the cloud symbol
- value (string) - the value of the cloud variable - always a string
Getting data
The server will send you the same data as in Setting data if the value of a cloud variable changes (and you weren't the person who set it). It'll still be the “set” method, but note that the “user” parameter will not be given to you (that's only given on client-to-server data)
Example
Here's a generic example of what a connection might look like:
- Client connects to clouddata.scratch.mit.edu
- Client sends handshake
{ "user": "exampleuser", "project_id": "1234567", "method": "handshake" }- Server tells client what the current value of the cloud variable is
{ "project_id": "1234567", "method": "set", "name": "☁ counter", "value": "12" }- Client tells server about a change to the cloud variable
{ "user": "exampleuser", "project_id": "1234567", "method": "set", "name": "☁ counter", "value": "13" }
Last edited by space_elephant (Oct. 14, 2018 06:40:53)
- jokebookservice1
-
1000+ posts
How to Make a Cloud Var Watcher?
But how does the slider work?As you drag it, it updates the server as normal…
And how do I know who changed it?Good question! As far as people have discovered, the only way is to parse the HTML of the cloud logs. (The URL of these logs can be found by clicking a link below the relevant project)
- space_elephant
-
500+ posts
How to Make a Cloud Var Watcher?
Looking at this, the HTML does not help at all. the correct file is at https://clouddata.scratch.mit.edu/logs?projectid=279457375&limit=1&offset=0 and is JSON, not HTML.Good question! As far as people have discovered, the only way is to parse the HTML of the cloud logs. (The URL of these logs can be found by clicking a link below the relevant project) And how do I know who changed it?
Last edited by space_elephant (Jan. 26, 2019 16:01:50)
- Raytracing
-
86 posts
How to Make a Cloud Var Watcher?
How do I simulate a cloud var watcher?
EDIT: many have been confused about what I mean so:
I can doset[☁ cloud variable v]to[0]and I can also do
change[☁ cloud variable v]by(1)
(☁ cloud variable)
the only thing that I need help for is
Also the I can do that last one without the slider.
Check out my userstats project (it takes your info and uploads it to the cloud)
Then I made a python script to check what has been uploaded. so now I have a log of everyone >

Also my python script doesn't use and API's it only uses the tools provided in 3.0 . I could give you the script if you want

- space_elephant
-
500+ posts
How to Make a Cloud Var Watcher?
Unable to find either by hyperlinks on this page. Can you make one here?How do I simulate a cloud var watcher?
EDIT: many have been confused about what I mean so:
I can doset[☁ cloud variable v]to[0]and I can also do
change[☁ cloud variable v]by(1)
(☁ cloud variable)
the only thing that I need help for is
Also the I can do that last one without the slider.
Check out my userstats project (it takes your info and uploads it to the cloud)
Then I made a python script to check what has been uploaded. so now I have a log of everyone >
Also my python script doesn't use and API's it only uses the tools provided in 3.0 . I could give you the script if you want
- space_elephant
-
500+ posts
How to Make a Cloud Var Watcher?
With limit=0 you can get all logs.Looking at this, the HTML does not help at all. the correct file is at https://clouddata.scratch.mit.edu/logs?projectid=279457375&limit=1&offset=0 and is JSON, not HTML.Good question! As far as people have discovered, the only way is to parse the HTML of the cloud logs. (The URL of these logs can be found by clicking a link below the relevant project) And how do I know who changed it?
Last edited by space_elephant (Jan. 26, 2019 16:02:35)
- HowToLogic
-
34 posts
How to Make a Cloud Var Watcher?
Unable to find either by hyperlinks on this page. Can you make one here?
I think they mean: https://scratch.mit.edu/projects/277229912/
- Discussion Forums
- » Advanced Topics
-
» How to Make a Cloud Var Watcher?