Discuss Scratch
- blob8108
-
1000+ posts
Extension Discussion Thread
@Magnie But HTTP's simpler.
No-one's ever convinced the ST that something's better because it's more powerful.
No-one's ever convinced the ST that something's better because it's more powerful.

- Magnie
-
100+ posts
Extension Discussion Thread
Except, any real time games are likely not to work with plain HTTP… Why not get the basic stuff for it and then they can do their little fancy things with HTTP. @Magnie But HTTP's simpler.
No-one's ever convinced the ST that something's better because it's more powerful.

- itchy20
-
100+ posts
Extension Discussion Thread
Seems like there is a little confusion of which is better TCP or HTTP - the answer is neither. TCP is the transport machanism (at the transport layer) that HTTP (an application layer protocol) uses to move stuff back and forth from your web browser to web server.
So to support the latest extension, one would create a server socket like they would for any other TCP server and go through the normal connection dance between server and client. Once a link is established, the server needs to provide web server like services (specifically processing HTTP “GET” requests in addtion to the initial Flash cross domain thing).
If you want to see a working example in python, you can take a look at my extension at: https://github.com/MrYsLab/S2A
BTW, my extension uses a library provided within python to create the web server. Makes life a whole lot easier.
Now the question about HTTP performance issues is a valid one, but I don't have my fire suit on, so I will sidestep that discussion.
So to support the latest extension, one would create a server socket like they would for any other TCP server and go through the normal connection dance between server and client. Once a link is established, the server needs to provide web server like services (specifically processing HTTP “GET” requests in addtion to the initial Flash cross domain thing).
If you want to see a working example in python, you can take a look at my extension at: https://github.com/MrYsLab/S2A
BTW, my extension uses a library provided within python to create the web server. Makes life a whole lot easier.
Now the question about HTTP performance issues is a valid one, but I don't have my fire suit on, so I will sidestep that discussion.
- DigiTechs
-
500+ posts
Extension Discussion Thread
Gah.
I find it a bad idea that Scratch use HTTP requests for extensions now D:
I find it a bad idea that Scratch use HTTP requests for extensions now D:
- khanning
-
34 posts
Extension Discussion Thread
Looks like there have been more changes to experimental extensions.
You can no longer import an extension by Shift + clicking the File menu. There is no longer an option to import experimental extensions.
If you hold Shift and click the “More Blocks” tab there is a new button that says “Add an Extension”. This opens the extension library which currently only offers the Picoboard and WeDo. Clearly there is some restructuring going on with extensions. Hopefully we will still be able to upload our extensions or even submit them to be included in the extensions library.
You can no longer import an extension by Shift + clicking the File menu. There is no longer an option to import experimental extensions.
If you hold Shift and click the “More Blocks” tab there is a new button that says “Add an Extension”. This opens the extension library which currently only offers the Picoboard and WeDo. Clearly there is some restructuring going on with extensions. Hopefully we will still be able to upload our extensions or even submit them to be included in the extensions library.
- DigiTechs
-
500+ posts
Extension Discussion Thread
Sounds cool. Looks like there have been more changes to experimental extensions.
You can no longer import an extension by Shift + clicking the File menu. There is no longer an option to import experimental extensions.
If you hold Shift and click the “More Blocks” tab there is a new button that says “Add an Extension”. This opens the extension library which currently only offers the Picoboard and WeDo. Clearly there is some restructuring going on with extensions. Hopefully we will still be able to upload our extensions or even submit them to be included in the extensions library.
Hopefully experimental extensions other than PicoBoard and WeDo can be made soon

- davidkt
-
1000+ posts
Extension Discussion Thread
Sounds cool. Looks like there have been more changes to experimental extensions.
You can no longer import an extension by Shift + clicking the File menu. There is no longer an option to import experimental extensions.
If you hold Shift and click the “More Blocks” tab there is a new button that says “Add an Extension”. This opens the extension library which currently only offers the Picoboard and WeDo. Clearly there is some restructuring going on with extensions. Hopefully we will still be able to upload our extensions or even submit them to be included in the extensions library.
Hopefully experimental extensions other than PicoBoard and WeDo can be made soon

- ykoubo
-
11 posts
Extension Discussion Thread
Looks like there have been more changes to experimental extensions.
You can no longer import an extension by Shift + clicking the File menu. There is no longer an option to import experimental extensions.
If you hold Shift and click the “More Blocks” tab there is a new button that says “Add an Extension”. This opens the extension library which currently only offers the Picoboard and WeDo. Clearly there is some restructuring going on with extensions. Hopefully we will still be able to upload our extensions or even submit them to be included in the extensions library.
The Offline Editor has ‘Import External Extension’ in Shift + File menu, so far.
Updated Scratch 2 Offline Editor (Beta) is now available!
- DigiTechs
-
500+ posts
Extension Discussion Thread
Yeah, but being able to do it online is a LOT easier.Looks like there have been more changes to experimental extensions.
You can no longer import an extension by Shift + clicking the File menu. There is no longer an option to import experimental extensions.
If you hold Shift and click the “More Blocks” tab there is a new button that says “Add an Extension”. This opens the extension library which currently only offers the Picoboard and WeDo. Clearly there is some restructuring going on with extensions. Hopefully we will still be able to upload our extensions or even submit them to be included in the extensions library.
The Offline Editor has ‘Import External Extension’ in Shift + File menu, so far.
Updated Scratch 2 Offline Editor (Beta) is now available!
Darn, 60 second rule.
- technoboy10
-
1000+ posts
Extension Discussion Thread
Here's some new info for you guys. 
Firstly, you can now define your own dropdown menus. In the blockspecs, use %m.menuName for a non-editable menu, and define your custom menus in the extension.json file like so:
“menus”: {
“coordinate”: ,
“bodyPart”: ,
},
.
Also, reporters get values by HTTP GETting a /poll URL.
Also, to signify a problem with an extension…

Firstly, you can now define your own dropdown menus. In the blockspecs, use %m.menuName for a non-editable menu, and define your custom menus in the extension.json file like so:
“menus”: {
“coordinate”: ,
“bodyPart”: ,
},
.
Also, reporters get values by HTTP GETting a /poll URL.
In response to a poll command, the helper app sends back a list of (sensor name, value) pairs, one
pair per line. Each line in the poll response should end with a newline character (0xA) and the
sensor name and value should be separated by a space character. String values should be URL-
encoded. Scratch sends poll commands roughly 30 times per second.
Here's an example poll response:
brightness 75
slider 17
Also, to signify a problem with an extension…
The response to a poll request can include a problem report to help users troubleshoot. A
problem report consists of the string “_problem” followed by a space followed by a short
description of the problem. For example:
_problem The Scratch Sensor board is not connected.
Last edited by technoboy10 (Oct. 10, 2013 21:28:42)
- mqtt
-
9 posts
Extension Discussion Thread
Being able to use a socket or websocket to communicate to the “outside world” opens up a massive range of possibilities.
I was keen to create an extension to enable data/events to be communicated in near real time from a device into scratch 2.0 and vice versa. Having found this thread things were looking good but quickly came down to earth with a bump as the ability to load experimental extensions appears to no longer be accessible. Am I missing something, if not any idea when this feature will be re-instated ?
I was keen to create an extension to enable data/events to be communicated in near real time from a device into scratch 2.0 and vice versa. Having found this thread things were looking good but quickly came down to earth with a bump as the ability to load experimental extensions appears to no longer be accessible. Am I missing something, if not any idea when this feature will be re-instated ?
- blob8108
-
1000+ posts
Extension Discussion Thread
@mqtt Use the offline player.
Last edited by blob8108 (Oct. 11, 2013 17:53:34)
- mqtt
-
9 posts
Extension Discussion Thread
Attempting to use the offline player and experimenting with extensions. The local extension server is now receiving the poll request and is replying with an HTTP payload of the form name value Silly question but how can the name and value be used in a Scratch program? (thought it might have showed up as a variable).
Other observations with the latest version of scratch offline :
1) Not seeing the cross-domain request as suggested in the first post
2) I have a command block configured but the command does not appear to be sent through the extension server
Other observations with the latest version of scratch offline :
1) Not seeing the cross-domain request as suggested in the first post
2) I have a command block configured but the command does not appear to be sent through the extension server
Last edited by mqtt (Oct. 13, 2013 11:31:40)
- mqtt
-
9 posts
Extension Discussion Thread
Sorted out how to use the info from the reporter inside the scratch program and simple command block now working.
Per other comments having scratch poll the extension server 30 times a second is not efficient. It causes a lot of overhead both in cases where a sensor reading changes infrequently and in cases where it changes frequently. Using a socket or websocket so that the extension server can notify scratch when an event occurs would provide a more efficient implementation.
Per other comments having scratch poll the extension server 30 times a second is not efficient. It causes a lot of overhead both in cases where a sensor reading changes infrequently and in cases where it changes frequently. Using a socket or websocket so that the extension server can notify scratch when an event occurs would provide a more efficient implementation.
Last edited by mqtt (Oct. 13, 2013 16:25:19)
- FredMcFred
-
5 posts
Extension Discussion Thread
mqtt - I think I'm at a similar point to you. Have a local poll request responding with name/value that I'm using in my reporter, but wondering where to go next.
What are you using on the server-side to catch the poll request? I can't see any payload going with it. Do you know does it pass a param based on which blocks are being access?
Thanks
What are you using on the server-side to catch the poll request? I can't see any payload going with it. Do you know does it pass a param based on which blocks are being access?
Thanks
- mqtt
-
9 posts
Extension Discussion Thread
@FredMcFred have just written up my findings on my blog here http://davejlocke.wordpress.com/2013/10/14/14/
Last edited by mqtt (Oct. 14, 2013 22:17:28)
- FredMcFred
-
5 posts
Extension Discussion Thread
@mqtt - most excellent, thanks for the link. I'll read it properly over lunch!
Your comments about the extension feature being in a state of flux ring true. Hopefully when it does settle down, there won't be too much to rework.
Your comments about the extension feature being in a state of flux ring true. Hopefully when it does settle down, there won't be too much to rework.
- blob8108
-
1000+ posts
Extension Discussion Thread
There's a new, updated topic for discussing the new extension protocol.