Discuss Scratch

NitroCipher
Scratcher
100+ posts

Creating extensions for Scratch 3.0

With the upcoming Scratch 3.0, the extension structure has been completely revamped.

What we know:

  • Extensions are still using javascript
  • Block are now defined by
                {
                    opcode: 'example-noop',
                    blockType: Scratch.BlockType.COMMAND,
                    blockAllThreads: false,
                    text: 'do nothing',
                    func: 'noop'
                },
    
    rather than
    [' ', 'do nothing', 'noop', ""]
    
  • Extensions now have built in translation support
    translation_map: {
                de: {
                    'extensionName': 'Einige Blöcke',
                    'myReporter': 'Buchstabe [LETTER_NUM] von [TEXT]',
                    'myReporter.TEXT_default': 'Text',
                    'menuA_item1': 'Artikel eins',
                    // Dynamic menus can be translated too
                    'menuB_example': 'Beispiel',
                    // This message contains ICU placeholders (see `myReporter()` below)
                    'myReporter.result': 'Buchstabe {LETTER_NUM} von {TEXT} ist {LETTER}.'
                },
                it: {
                    // ...
                }
            },
    
  • You can define where the blocks will appear (IE just the stage or just sprites)
                    // Optional: list of target types for which this block should appear.
                    // If absent, assume it applies to all builtin targets -- that is:
                    // ['sprite', 'stage']
                    filter: ['someBlocks.wedo2', 'sprite', 'stage']
                },
    
  • Menus are now defined:
    const ColorParam = {
        COLOR: 'color',
        SATURATION: 'saturation',
        BRIGHTNESS: 'brightness',
        TRANSPARENCY: 'transparency'
    };
    


Please help contribute to this thread, check out the github to help deconstruct the new format.
(more updates will be posted later)

Last edited by NitroCipher (Jan. 8, 2018 18:21:14)


I hope my post helped you in some way! Post count: 400+

Current project: [Pokemon FireRed] ::extension //https://scratch.mit.edu/discuss/topic/210324/
This is my signature identifier “aWFtbml0cm9jaXBoZXI=”
savaka
Scratcher
1000+ posts

Creating extensions for Scratch 3.0

Looks a lot easier to understand

Last edited by savaka (Sept. 20, 2017 19:10:14)



Signature protected by Savaka Antikumquat
Abe_Lincoln
Scratcher
41 posts

Creating extensions for Scratch 3.0

savaka wrote:

Looks a lot easier to understand
Yes, but a lot longer than a simple line of JSON. It just means all extensions will have to be updated. Maybe I should build a converter that does that.

aqmoreira
New to Scratch
1 post

Creating extensions for Scratch 3.0

Hi NitroCipher,

I'm playing with scratch 3 and found this post. Can you tell me where I can find more information to make a Command button that in the arguments values ​​come from a menu or array.

Samples:
point towards [ v]


Thanks,

Allan Moreira
NitroCipher
Scratcher
100+ posts

Creating extensions for Scratch 3.0

aqmoreira wrote:

Hi NitroCipher,

I'm playing with scratch 3 and found this post. Can you tell me where I can find more information to make a Command button that in the arguments values ​​come from a menu or array.

Samples:
point towards [ v]


Thanks,

Allan Moreira

At the moment, not much is known (publically) about the extensions. I will post here as soon as I discover more.

I hope my post helped you in some way! Post count: 400+

Current project: [Pokemon FireRed] ::extension //https://scratch.mit.edu/discuss/topic/210324/
This is my signature identifier “aWFtbml0cm9jaXBoZXI=”
JGames101
Scratcher
100+ posts

Creating extensions for Scratch 3.0

Ooh! Translation support!
translation_map: {
            de: {
                'extensionName': 'Einige Blöcke',
                'myReporter': 'Buchstabe [LETTER_NUM] von [TEXT]',
                'myReporter.TEXT_default': 'Text',
                'menuA_item1': 'Artikel eins',
                // Dynamic menus can be translated too
                'menuB_example': 'Beispiel',
                // This message contains ICU placeholders (see `myReporter()` below)
                'myReporter.result': 'Buchstabe {LETTER_NUM} von {TEXT} ist {LETTER}.'
            },
            it: {
                // ...
            }
        },
This thing is interesting - it lets you filter where your block appears (stage, sprite, both), but in the example shows another extension.
                // Optional: list of target types for which this block should appear.
                // If absent, assume it applies to all builtin targets -- that is:
                // ['sprite', 'stage']
                filter: ['someBlocks.wedo2', 'sprite', 'stage']
            },

Last edited by JGames101 (Oct. 23, 2017 01:25:09)



Hey! I like working with Scratch 3.

Scratch 3 Modding

My Website
JGames101
Scratcher
100+ posts

Creating extensions for Scratch 3.0

aqmoreira wrote:

Hi NitroCipher,

I'm playing with scratch 3 and found this post. Can you tell me where I can find more information to make a Command button that in the arguments values ​​come from a menu or array.

Samples:
point towards [ v]


Thanks,

Allan Moreira
Here's the menu stuff I found:
// Optional: define extension-specific menus here.
        menus: {
            // Required: an identifier for this menu, unique within this extension.
            menuA: [
                // Static menu: list items which should appear in the menu.
                {
                    // Required: the value of the menu item when it is chosen.
                    value: 'itemId1',
                    // Optional: the human-readable label for this item.
                    // Use `value` as the text if this is absent.
                    text: 'Item One'
                },
                // The simplest form of a list item is a string which will be used as
                // both value and text.
                'itemId2'
            ],
            // Dynamic menu: a string naming a function which returns an array as above.
            // Called each time the menu is opened.
            menuB: 'getItemsForMenuB'
        },


Hey! I like working with Scratch 3.

Scratch 3 Modding

My Website
AmazingMech2418
Scratcher
100+ posts

Creating extensions for Scratch 3.0

I actually found stuff like this on the Scratch 3.0 source code extension example. How do you add an extension to a project in Scratch 3?

set [variable v] to [true]
if <<I finally learned how to do a signature :: sensing> = <variable :: variables>> then
set [response v] to [YES!!!!!]
end
say (show::looks stack) for (stop [all v]::cap) secs
NitroCipher
Scratcher
100+ posts

Creating extensions for Scratch 3.0

AmazingMech2418 wrote:

I actually found stuff like this on the Scratch 3.0 source code extension example. How do you add an extension to a project in Scratch 3?

I have yet to figure out how to do it any other way than putting the code into a fork of scratch 3.0 on github

I hope my post helped you in some way! Post count: 400+

Current project: [Pokemon FireRed] ::extension //https://scratch.mit.edu/discuss/topic/210324/
This is my signature identifier “aWFtbml0cm9jaXBoZXI=”
JGames101
Scratcher
100+ posts

Creating extensions for Scratch 3.0

I am working on porting my extensions to Scratch 3 with the new format. Do you know where the actual used extension files are stored? Not the examples, but where the actual extension file is?


Hey! I like working with Scratch 3.

Scratch 3 Modding

My Website
PullJosh
Scratcher
1000+ posts

Creating extensions for Scratch 3.0

JGames101 wrote:

I am working on porting my extensions to Scratch 3 with the new format. Do you know where the actual used extension files are stored? Not the examples, but where the actual extension file is?
Not entirely sure what you're tying to ask, but this might be of interest: https://github.com/LLK/scratch-vm/tree/develop/src/extensions

JGames101-Tutorials
Scratcher
70 posts

Creating extensions for Scratch 3.0

PullJosh wrote:

JGames101 wrote:

I am working on porting my extensions to Scratch 3 with the new format. Do you know where the actual used extension files are stored? Not the examples, but where the actual extension file is?
Not entirely sure what you're tying to ask, but this might be of interest: https://github.com/LLK/scratch-vm/tree/develop/src/extensions
That's exactly what I was looking for, thanks


NitroCipher
Scratcher
100+ posts

Creating extensions for Scratch 3.0

Thx for the sticky!

I hope my post helped you in some way! Post count: 400+

Current project: [Pokemon FireRed] ::extension //https://scratch.mit.edu/discuss/topic/210324/
This is my signature identifier “aWFtbml0cm9jaXBoZXI=”
JGames101
Scratcher
100+ posts

Creating extensions for Scratch 3.0

I have managed to port one of my extension to Scratch 3 (the blocks don't completely work yet, but I'm working on that, but they do load)

I followed the instructions to download the latest version of the scratch gui to work on it. I then copied the example extension, and rewrote my notifications extension in that format. Then, I uploaded it to github. I found the file that controls the list of extensions in the extensions button, and added mine. I set the URL to my github file, and it loaded in, and as you can see, the blocks appeared.

Official instructions for developing Scratch 3 extensions will be coming sometime between now and August (Scratch 3 release), according to The FAQ.

Update: I have everything working, except asking for notification permission. For some reason, that doesn't work.
Code can be found at https://github.com/JGames101/scratch-extensions/blob/master/notifications/3.js

To test your extension, add it to the index.js file located here: https://github.com/LLK/scratch-gui/tree/develop/src/lib/libraries/extensions
You can use actual URLs.
Then, if you open the page, you should see an extra Extension under the extensions popup thing. Clicking it will add your extension to the project, and you can test it.

So… testing your extensions currently requires downloading the source for scratch 3's GUI. No parts, like the VM or Renderer, are needed to be changed to test extensions, despite where default scratch extensions are stored (I went through the process of forking the VM for nothing…)

I will be making some simple demo extensions, that you'll be able to see below, and then I'll publish a fork of Scratch-GUI with some sample extensions.

Last edited by JGames101 (Jan. 13, 2018 22:10:54)



Hey! I like working with Scratch 3.

Scratch 3 Modding

My Website
NitroCipher
Scratcher
100+ posts

Creating extensions for Scratch 3.0

JGames101 wrote:

I have managed to port one of my extension to Scratch 3 (the blocks don't completely work yet, but I'm working on that, but they do load)

I followed the instructions to download the latest version of the scratch gui to work on it. I then copied the example extension, and rewrote my notifications extension in that format. Then, I uploaded it to github. I found the file that controls the list of extensions in the extensions button, and added mine. I set the URL to my github file, and it loaded in, and as you can see, the blocks appeared.

Official instructions for developing Scratch 3 extensions will be coming sometime between now and August (Scratch 3 release), according to The FAQ.

Update: I have everything working, except asking for notification permission. For some reason, that doesn't work.
Code can be found at https://github.com/JGames101/scratch-extensions/blob/master/notifications/3.js

To test your extension, add it to the index.js file located here: https://github.com/LLK/scratch-gui/tree/develop/src/lib/libraries/extensions
You can use actual URLs.
Then, if you open the page, you should see an extra Extension under the extensions popup thing. Clicking it will add your extension to the project, and you can test it.

So… testing your extensions currently requires downloading the source for scratch 3's GUI. No parts, like the VM or Renderer, are needed to be changed to test extensions, despite where default scratch extensions are stored (I went through the process of forking the VM for nothing…)

I will be making some simple demo extensions, that you'll be able to see below, and then I'll publish a fork of Scratch-GUI with some sample extensions.

Cool, which format do you find easier to use? Personally I like the old format, mainly because I am more used to it, and I haven't played with the new one much.

I hope my post helped you in some way! Post count: 400+

Current project: [Pokemon FireRed] ::extension //https://scratch.mit.edu/discuss/topic/210324/
This is my signature identifier “aWFtbml0cm9jaXBoZXI=”
JGames101
Scratcher
100+ posts

Creating extensions for Scratch 3.0

NitroCipher wrote:

JGames101 wrote:

I have managed to port one of my extension to Scratch 3 (the blocks don't completely work yet, but I'm working on that, but they do load)

I followed the instructions to download the latest version of the scratch gui to work on it. I then copied the example extension, and rewrote my notifications extension in that format. Then, I uploaded it to github. I found the file that controls the list of extensions in the extensions button, and added mine. I set the URL to my github file, and it loaded in, and as you can see, the blocks appeared.

Official instructions for developing Scratch 3 extensions will be coming sometime between now and August (Scratch 3 release), according to The FAQ.

Update: I have everything working, except asking for notification permission. For some reason, that doesn't work.
Code can be found at https://github.com/JGames101/scratch-extensions/blob/master/notifications/3.js

To test your extension, add it to the index.js file located here: https://github.com/LLK/scratch-gui/tree/develop/src/lib/libraries/extensions
You can use actual URLs.
Then, if you open the page, you should see an extra Extension under the extensions popup thing. Clicking it will add your extension to the project, and you can test it.

So… testing your extensions currently requires downloading the source for scratch 3's GUI. No parts, like the VM or Renderer, are needed to be changed to test extensions, despite where default scratch extensions are stored (I went through the process of forking the VM for nothing…)

I will be making some simple demo extensions, that you'll be able to see below, and then I'll publish a fork of Scratch-GUI with some sample extensions.

Cool, which format do you find easier to use? Personally I like the old format, mainly because I am more used to it, and I haven't played with the new one much.
I think that this one will be easier for people who have never made extensions before, but I think I personally prefer the older one. I don't mind the new one, though, and it has some nice new features.


Hey! I like working with Scratch 3.

Scratch 3 Modding

My Website
edbotinschools
Scratcher
3 posts

Creating extensions for Scratch 3.0

Hi.
I currently have an HTTP extension in Scratch 2. Any ideas how I can convert this to Scratch 3??
Thanks.
C
NitroCipher
Scratcher
100+ posts

Creating extensions for Scratch 3.0

edbotinschools wrote:

Hi.
I currently have an HTTP extension in Scratch 2. Any ideas how I can convert this to Scratch 3??
Thanks.
C

Hi! Can you put the extension up on github? I'd be happy to take a look at it!

(I am not entirely familiar with HTTP extensions, I mainly focus on javascript)

I hope my post helped you in some way! Post count: 400+

Current project: [Pokemon FireRed] ::extension //https://scratch.mit.edu/discuss/topic/210324/
This is my signature identifier “aWFtbml0cm9jaXBoZXI=”
CoolGamesNet
Scratcher
4 posts

Creating extensions for Scratch 3.0

NitroCipher,
I am not the originator but I just started with the Roland Go:Keys 61 extension added to Ver.1.21 firmware.

https://rolandcom.github.io/gokeys-scratch-extension/res/gokeys_block.jpg

https://www.roland.com/us/products/gokeys_go-61k/downloads/
and
https://rolandcom.github.io/gokeys-scratch-extension/

I am https://github.com/CoolGames or here as Developer at CoolGames dot net

Please help as I am using Ubuntu Studio 17.10 Linux and have the offline editor localhost working as much I can
with out Node.JS or NPM skills.
I would like to test the existing and rewritten extension and communicate with Roland for this effort.

Lee T. Davy
Retired and still working for our children's future !

Powered by DjangoBB

Standard | Mobile