Discuss Scratch

OnMax
Scratcher
20 posts

Creating extensions for Scratch 3.0

PullJosh wrote:

OnMax wrote:

Do you mean, I can just use self instead of window?
Haven't tested myself, but it looks like yes.

It doesn't works. It just still doesn't works…

link - js file

forever
Imagine::looks
Programm::sensing
Share::motion
end

Scratch on!::variables
SimpleScratch
Scratcher
100+ posts

Creating extensions for Scratch 3.0

@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


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
Please don't feel the obligation to post on every single topic you see; eventually you will resort to spam.
Another suggestion has been implemented!
.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
Please don't feel the obligation to post on every single topic you see; eventually you will resort to spam.
Another suggestion has been implemented!
.postsignature { overflow: auto; } .scratchblocks { overflow-x: auto; overflow-y: hidden; }
OnMax
Scratcher
20 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

forever
Imagine::looks
Programm::sensing
Share::motion
end

Scratch on!::variables
dalelane
Scratcher
3 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
Please don't feel the obligation to post on every single topic you see; eventually you will resort to spam.
Another suggestion has been implemented!
.postsignature { overflow: auto; } .scratchblocks { overflow-x: auto; overflow-y: hidden; }
Sithlord1000
Scratcher
17 posts

Creating extensions for Scratch 3.0

I think there should be a EV3 extension.

Hi. Are the potatoes president yet?
SimpleScratch
Scratcher
100+ 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
36 posts

Creating extensions for Scratch 3.0

I want lego boost!
OnMax
Scratcher
20 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

forever
Imagine::looks
Programm::sensing
Share::motion
end

Scratch on!::variables
ahmetlii
Scratcher
23 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.

I'm basic scratcher's. #weareallhuman
Ben basit bir scratch'çiyim. #hepimizinsanız

%100 Türk Scratch Wiki-Türk Scratch Wiki: https://test.scratch-wiki.info/wiki/Tur:Anasayfa
Sizin yardımınıza İHTİYACIMIZ VAR!
Test-Scratch-Wiki hesabım(My Test-Scratch-Wiki Account):Ahmetlii

If you see my projects,please look this(Eğer benim projelerimi görmek istiyorsanız,lütfen şunlara bakın):
in Turkish(Türkçe)
in English
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

Base 10 is the best number system.
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.

Base 10 is the best number system.
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)


art blog – My pronouns are they/them, btw. sparrows one word to the paragraph

Powered by DjangoBB

Standard | Mobile