This article or section documents something not included in the current version of Scratch (3.0). It is only useful from a historical perspective. |
This article is a stub. It may be incomplete, unfinished, or have missing parts/sections. If the article can be expanded, please do so! There may be suggestions on its talk page. (April 2018) |
Although only the Scratch Team can add extensions to Scratch, anyone can make experimental extensions for ScratchX. This is a tutorial for making ScratchX extensions.
- Create a JavaScript file on a computer, and add the content
(function(ext) { // Cleanup function when the extension is unloaded ext._shutdown = function() {}; // Status reporting code // Use this to report missing hardware, plugin or unsupported browser ext._getStatus = function() { return {status: 2, msg: 'Ready'}; }; // Block and block menu descriptions var descriptor = { blocks: [ ] }; // Register the extension ScratchExtensions.register('Sample extension', descriptor, ext); })({});
- At the bottom, replace "Sample Extension" with the name of the extension
- Add a block. Blocks go in the block array on line 13. Block code looks like this:
['block type','block content','block function name']
This contains 3 things to fill in:
block type: The type of block. Types are
Block Type | Value |
---|---|
Stack | (one space) |
Waiting Stack | W |
Reporter | r |
Waiting Reporter | R |
Hat | h |
Boolean | b |
block content: Type in the text of the block Use %s for string inputs and %n for number inputs. block function name The name of the function for your block, in the ext object.
For more help making extensions, see the extension documentation