Discuss Scratch

Sheep_maker
Scratcher
1000+ posts

Creating extensions for Scratch 3.0

SimpleScratch wrote:

@Sheep_maker

Thanks for your Scratch3 mod with your external extension loader

One “small” issue I'm having with it is that I can't seem to re-load projects that use your utilities extension
(Its just sits there giving an endless series of messages about loading the file/sprites/extensions etc)

Is this just happening to me or is it a general issue?

Simon


Yes, it's happening to me too. Based on my observations, perhaps Scratch 3.0 uses the extension ID as the URL of the extension, which makes sense since internally they're the same thing. I will look into this.

Last edited by Sheep_maker (Aug. 8, 2018 16:31:21)


- Sheep_maker This is a kumquat-free signature. :P
This is my signature. It appears below all my posts. Discuss it on my profile, not the forums. Here's how to make your own.
.postsignature { overflow: auto; } .scratchblocks { overflow-x: auto; overflow-y: hidden; }
Sheep_maker
Scratcher
1000+ posts

Creating extensions for Scratch 3.0

I've updated my mod; it should now have the latest Beta features, and I also fixed two issues:
  • clicking on extension reporters was very buggy
  • can't upload extension-using projects
I've fixed the second problem by slightly modifying the SB3 format to include the extension URLs. With this, I've also changed the file extension to .sb3x

- Sheep_maker This is a kumquat-free signature. :P
This is my signature. It appears below all my posts. Discuss it on my profile, not the forums. Here's how to make your own.
.postsignature { overflow: auto; } .scratchblocks { overflow-x: auto; overflow-y: hidden; }
OnMax
Scratcher
51 posts

Creating extensions for Scratch 3.0

Sheep_maker wrote:

I've updated my mod; it should now have the latest Beta features, and I also fixed two issues:
  • clicking on extension reporters was very buggy
  • can't upload extension-using projects
I've fixed the second problem by slightly modifying the SB3 format to include the extension URLs. With this, I've also changed the file extension to .sb3x

Yay great

… i guess, i just do something here
dalelane
Scratcher
6 posts

Creating extensions for Scratch 3.0

Sheep_maker wrote:

Because of how extensions are registered, external extensions don't have access to the magical “runtime” thing which means you can't do much with the default Scratch unlike the currently provided extensions. Maybe I'll find a way to change that.

Have you made any progress with this? Do you know if it's a permanent restriction for extensions in Scratch 3, or just something they probably haven't gotten to yet?
Sheep_maker
Scratcher
1000+ posts

Creating extensions for Scratch 3.0

dalelane wrote:

Sheep_maker wrote:

Because of how extensions are registered, external extensions don't have access to the magical “runtime” thing which means you can't do much with the default Scratch unlike the currently provided extensions. Maybe I'll find a way to change that.

Have you made any progress with this? Do you know if it's a permanent restriction for extensions in Scratch 3, or just something they probably haven't gotten to yet?
They haven't gotten to it yet; I am not working on giving extensions access to the runtime because it will likely be different than what the ST will do.

- Sheep_maker This is a kumquat-free signature. :P
This is my signature. It appears below all my posts. Discuss it on my profile, not the forums. Here's how to make your own.
.postsignature { overflow: auto; } .scratchblocks { overflow-x: auto; overflow-y: hidden; }
Sithlord1000
Scratcher
23 posts

Creating extensions for Scratch 3.0

I think there should be a EV3 extension.

Hi. Are the potatoes president yet?
SimpleScratch
Scratcher
500+ posts

Creating extensions for Scratch 3.0

I think there should be a EV3 extension.
There is one - click on the extensions button to see it
Timo79
Scratcher
3 posts

Creating extensions for Scratch 3.0

Can you add support for the SBrick to scratch 3.0 and maybe for the time being add it back to Scratch 2.0 because i have to use my backpack to get the blocks from another project at the moment
LegoRobin6
Scratcher
100+ posts

Creating extensions for Scratch 3.0

I want lego boost!
OnMax
Scratcher
51 posts

Creating extensions for Scratch 3.0

LegoRobin6 wrote:

I want lego boost!

There's already one but it was temporarily removed as a Speech extension

… i guess, i just do something here
ahmetlii
Scratcher
500+ posts

Creating extensions for Scratch 3.0

I think the popular developing cards(Arduino,Rasbperry Pi) should be supported in Scratch 3.0 .Examples,everyone isn't using the micro:bit,Picoboard,Lego and so expensive.Yes,maybe have 1-2 options,but not supported and don't enough.
I think this extensions making in the Scratch and including its all features.

Türkçe Scratch Viki'ye katılın!
Türk Scratch'çiler için Türk Scratch'çiler yapıyor.



sunnychawla
New to Scratch
1 post

Creating extensions for Scratch 3.0

What are the specifications and guidelines for scratch 3.0 extensions?
PullJosh
Scratcher
1000+ posts

Creating extensions for Scratch 3.0

sunnychawla wrote:

What are the specifications and guidelines for scratch 3.0 extensions?
Documentation still seems to be very much a work in progress, but this should get you started on the right track: https://github.com/LLK/scratch-vm/wiki/Scratch-3.0-Extensions-Specification

You can also view the source code for the built-in extensions here: https://github.com/LLK/scratch-vm/tree/develop/src/extensions
netmille2000
New to Scratch
8 posts

Creating extensions for Scratch 3.0

Forum,

I would like to build Scratch 3.0 extensions.

At this time, I have followed steps from this post: https://scratch.mit.edu/discuss/topic/277217/?page=3#post-3161844

to incorporate the ‘Annotated example’ extension here: https://github.com/LLK/scratch-vm/wiki/Scratch-3.0-Extensions-Specification

into my local local ‘scratch-gui’. Basically, I am attempting to install the extension akin to the way the ‘built-in’ extensions are installed.

However, Once I perform respective steps, Scratch 3.0 is no longer able to run.

I suspect the Scratch 3 is having problems starting the new extension.

Please advise on steps to successfully incorporate the ‘Annotated example’ into my local Scratch 3.0.


My Environment:
————————-
NodeJS version - v10.8.0
Amazon Linux - (Cloud 9)

Thank you in advance.
netmille2000
New to Scratch
8 posts

Creating extensions for Scratch 3.0

Forum,

Using instructions from this post: https://scratch.mit.edu/discuss/topic/277217/?page=3#post-3161844,

I was able to get Scratch 3.0 to recognize my extension in the built-in extension menu as shown here:

https://www.dropbox.com/s/h9af43n5nnlqegv/BuiltinExtension-SomeBlocks.png?dl=0


But, when I select the my extension ‘SomeBlocks’, it is not added to the ‘Code’ section along with other blocks.

https://www.dropbox.com/s/uue5khesrvekpas/CodeSection.png?dl=0

My index.js file is located here: https://www.dropbox.com/s/umlek4k9lxs0z5t/index.js?dl=0

NOTE: It is take from the example: https://github.com/LLK/scratch-gui/tree/develop/src/examples/extensions

Please advise on how to get the Scratch 3.0 to properly install the extension.

Thank you in advance.




Last edited by netmille2000 (Sept. 19, 2018 00:57:07)

PullJosh
Scratcher
1000+ posts

Creating extensions for Scratch 3.0

netmille2000 wrote:

I was able to get Scratch 3.0 to recognize my extension in the built-in extension menu. […] But, when I select the my extension ‘SomeBlocks’, it is not added to the ‘Code’ section along with other blocks. […] My index.js file is located here: https://www.dropbox.com/s/umlek4k9lxs0z5t/index.js?dl=0

Please advise on how to get the Scratch 3.0 to properly install the extension.
It looks like you're already well on your way. I just went through the steps that you did, and found that the example extension (which you have hosted here) seems to be outdated. You didn't do anything wrong, but the extension is broken.

Try replacing that extension with this one, which I created as a bare-bones, simplest possible example:
// scratch-vm/src/extensions/scratch3_[YOUR_EXTENSION_NAME_HERE]/index.js
const BlockType = require('../../extension-support/block-type');
const ArgumentType = require('../../extension-support/argument-type');
class Scratch3MyExtension {
    constructor (runtime) {
        this.runtime = runtime;
    }
    getInfo () {
        return {
            id: 'myExtension', // Replace with the ID you specified in scratch-gui
            name: 'My Extension',
            blocks: [
                {
                    opcode: 'exponent',
                    text: '[BASE] ^ [POWER]',
                    blockType: BlockType.REPORTER,
                    arguments: {
                        BASE: {
                            type: ArgumentType.NUMBER,
                            defaultValue: 2
                        },
                        POWER: {
                            type: ArgumentType.NUMBER,
                            defaultValue: 3
                        }
                    }
                }
            ]
        };
    }
    exponent (args, util) {
        const {BASE, POWER} = args;
        return Math.pow(BASE, POWER);
    }
}
module.exports = Scratch3MyExtension;

You'll want to update the extension ID within the code to match whatever ID you entered when modifying the Scratch GUI to include the extension in the list (which you seem to have done successfully).

Hopefully that works. Let me know if you have any success (or run into any issues)!

PS: Do note that this extension is not following all of the best practices. For real extension development, you'll want to use the “formatMessage” function to allow for translations (I think). The purpose of my example is not to be perfect; it's to be a quick and easy extension to get running.
netmille2000
New to Scratch
8 posts

Creating extensions for Scratch 3.0

PullJosh,

Thank you so much for your help. Your example is exactly what I needed. I appreciate that you
provided a ‘very minimal’ example.. As it is helpful to understand what is exactly required.
_nix
Scratcher
1000+ posts

Creating extensions for Scratch 3.0

Yesterday I shared an extension I made – it adds some blocks for manipulating text. Here's the post quoted below:

_nix wrote:

Just thought I'd share a small extension I made. It adds a few new blocks, as shown below:
They all do pretty much exactly what you'd expect them to. The options in “replace” are (every, first, last). “Letters 1 to 5 of octopus” is “octop”; “-3 to -1” is “pus”. The “= and is the same case” block returns false for those options, whereas the normal operators “=” block returns true (since Scratch isn't normally case sensitive).

The code is pretty lengthy, so I've put it in a gist if you want to take a look. It's missing some JSDocs, but it should otherwise be fairly readable. Discussion and ideas are welcome!

Last edited by _nix (Oct. 5, 2018 02:11:14)


══ trans autistic lesbian enbydoggirls // 16 17 18 19 20, she/they
sparrows one word to the paragraph // <3 // ~(quasar) nebula
_nix
Scratcher
1000+ posts

Creating extensions for Scratch 3.0

NitroCipher wrote:

It would be a pain in the butt, but it might be possible for us to write a ScratchX to Ex3.0 conversion script.
This is a pretty old post, but I think this would definitely be possible, and probably not too hard…

══ trans autistic lesbian enbydoggirls // 16 17 18 19 20, she/they
sparrows one word to the paragraph // <3 // ~(quasar) nebula
NathanTGMPlays
Scratcher
7 posts

Creating extensions for Scratch 3.0

If Arduino could be supported in later versions of Scratch that would be great
define arduino main operating system
(Pin 13)

Powered by DjangoBB