Discuss Scratch

WPScratcher007
Scratcher
37 posts

Creating extensions for Scratch 3.0

LostLittleChick738 wrote:

I don't know exactly know how to create new extensions in Scratch. Do you sort of "hack" Scratch?
?

WPScratcher007 :3
come talk to me on my profile if you want
((m) + ([e v] ((o) < <[w] < (,(_(I(_(a(:3)m)_)a)_)c)at>)!)
see ya!
SimpleScratch
Scratcher
500+ posts

Creating extensions for Scratch 3.0

Yes.
Sheep_maker makes it possible to write extensions but you have to run them via their site and they can't be loaded on the normal Scratch site

I've sucessfully hacked the downloadable Scratch 3 versions but its a right pain in the neck to do so!

At the moment we can't just create extensions and submit them to Scratch team for approval and I personally doubt that we'll ever be able to do this( for at least the next few years)

Last edited by SimpleScratch (May 19, 2020 12:56:59)

LostLittleChick738
Scratcher
500+ posts

Creating extensions for Scratch 3.0

There could be blocks from Snap.

"when life gives you lemons, don't give them to chickens." -me
now, I am not a chicken, despite my name.
i just like them. check out me projects:

LostLittleChick738
Scratcher
500+ posts

Creating extensions for Scratch 3.0

cs1760725 wrote:

how about these for scratch it's the compassion without the extention and with
Did you mean
if keys <space:: events> <up:: events> <down:: events> <left:: events> pressed then:: events hat
dance (cause it works:: sensing):: motion
when gf clicked
if <<key [space v] pressed?> or <<key [up arrow v] pressed?> or <<key [down arrow v] pressed?> or <key [left arrow v] pressed?>>>> then
dance (cause it works:: sensing):: motion
end
?


"when life gives you lemons, don't give them to chickens." -me
now, I am not a chicken, despite my name.
i just like them. check out me projects:

LostLittleChick738
Scratcher
500+ posts

Creating extensions for Scratch 3.0

SimpleScratch wrote:

Yes.
Sheep_maker makes it possible to write extensions but you have to run them via their site and they can't be loaded on the normal Scratch site

I've sucessfully hacked the downloadable Scratch 3 versions but its a right pain in the neck to do so!

At the moment we can't just create extensions and submit them to Scratch team for approval and I personally doubt that we'll ever be able to do this( for at least the next few years)
when @greenFlag <when @greenFlag <when @greenFlag <when gf clicked:: hat>:: events hat>:: events hat>:: events hat
((((How)) + ((((do)) + <(know)> (all of(this?):: #FF00FF)>))(((How) + (join [? ] [How]):: extension (do (you):: custom) ((that) - (?)):: #ADD8E6):: #00FFFF):: #1b03a3 stack
say (((HOW) + ((DO) + (join [YOU] (join [KNOW] <[THIS]> [?]>:: operators))))
[freak out v]:: motion cap

Last edited by LostLittleChick738 (May 19, 2020 18:32:43)


"when life gives you lemons, don't give them to chickens." -me
now, I am not a chicken, despite my name.
i just like them. check out me projects:

LostLittleChick738
Scratcher
500+ posts

Creating extensions for Scratch 3.0

I'm more confused than anyone else.


"when life gives you lemons, don't give them to chickens." -me
now, I am not a chicken, despite my name.
i just like them. check out me projects:

LostLittleChick738
Scratcher
500+ posts

Creating extensions for Scratch 3.0

SimpleScratch wrote:

Yes.
Sheep_maker makes it possible to write extensions but you have to run them via their site and they can't be loaded on the normal Scratch site

I've successfully hacked the downloadable Scratch 3 versions but its a right pain in the neck to do so!

At the moment we can't just create extensions and submit them to Scratch team for approval and I personally doubt that we'll ever be able to do this( for at least the next few years)
But I can't hack ‘cause I don’t know how to. Do you just inspect (Ctrl + Shift + I)?






"when life gives you lemons, don't give them to chickens." -me
now, I am not a chicken, despite my name.
i just like them. check out me projects:

rioi123
Scratcher
18 posts

Creating extensions for Scratch 3.0

how to use the extension?
I mean where to paste them or something
go to [??? v]

when I receive [scratch v]
if <not (<<[polubiłeś v]> and <[śledzisz v]>> of (join [wszystkich] (join [moich] (<projektów::operators> and <studiów::sensing>))))> then::custom
say [sory] for (infinity) secs
zrób to::events
end

                            
Darsh1994
New to Scratch
14 posts

Creating extensions for Scratch 3.0

Hi, thanks for the great explanation. Can someone please tell me how can I add "on green flag clicked event“ for particular ”hat" type block in extension? I want to execute some part of code when “PROJECT_RUN_START” event triggered. right now this event is triggered by scratch native event block only.

Last edited by Darsh1994 (May 22, 2020 11:15:32)

Jonathan50
Scratcher
1000+ posts

Creating extensions for Scratch 3.0

LostLittleChick738 wrote:

I don't know exactly know how to create new extensions in Scratch. Do you sort of "hack" Scratch?

8bitjake wrote:

I want to create Scratch extensions, but I have no experience with Java. How do I create an extension w/out Java?
This topic explains how to make Scratch extensions, but you'll want to understand the JavaScript programming language first. (JavaScript isn't the same as Java.)

Last edited by Jonathan50 (May 22, 2020 23:22:16)


Not yet a Knight of the Mu Calculus.
TUX_OS
Scratcher
500+ posts

Creating extensions for Scratch 3.0

Nice I Am developer I use Blockly! But when I turn it into scratchblock that make wrong

My favorite thing is translating Emoji language in Russian
TUX_OS
Scratcher
500+ posts

Creating extensions for Scratch 3.0

when green flag clicked :: extension
say [LOL black blocks!] for (2 :: extension) secs :: extension
They are extensions :: extension cap

My favorite thing is translating Emoji language in Russian
TheGeniusCoder
Scratcher
100+ posts

Creating extensions for Scratch 3.0

SimpleScratch wrote:

Yes.
Sheep_maker makes it possible to write extensions but you have to run them via their site and they can't be loaded on the normal Scratch site

I've sucessfully hacked the downloadable Scratch 3 versions but its a right pain in the neck to do so!

At the moment we can't just create extensions and submit them to Scratch team for approval and I personally doubt that we'll ever be able to do this( for at least the next few years)
wanna link the hacked downloadable version? or show it off with screenshots

I'm someone who loves to code and make people happy please check out my profile @TheGeniusCoder follow, comment love, favorite, or do whatever.
SimpleScratch
Scratcher
500+ posts

Creating extensions for Scratch 3.0

This is my original blog - I've haven't updated it/tried it since late 2019

http://simplesi.net/s3gpioalpha/

The comments explain the process

PiglinZumbi
Scratcher
17 posts

Creating extensions for Scratch 3.0

.

Last edited by PiglinZumbi (July 1, 2020 03:00:47)

PiglinZumbi
Scratcher
17 posts

Creating extensions for Scratch 3.0

when I receive [simple make in this site: v]
think [:D] for (2) secs
if <(answer) = [But only for 18 years old or more]> then
say [...ToT] for (2) secs
end

Last edited by PiglinZumbi (July 1, 2020 03:00:03)

Gohoski
Scratcher
100+ posts

Creating extensions for Scratch 3.0

I am having some trouble with hosting the extension with github pages. I got to the mod, loaded the extension, and…. nothing happens. But I get errors in the console. Here's the error:
shared-dispatch.js:130 Uncaught (in promise) TypeError: Cannot read property ‘yield’ of null
at shared-dispatch.js:130
at new Promise (<anonymous>)
at WorkerDispatch._remoteTransferCall (shared-dispatch.js:126)
at WorkerDispatch.transferCall (shared-dispatch.js:82)
at WorkerDispatch.call (shared-dispatch.js:59)
at extension-worker.js:28
(anonymous) @ shared-dispatch.js:130
_remoteTransferCall @ shared-dispatch.js:126
transferCall @ shared-dispatch.js:82
call @ shared-dispatch.js:59
(anonymous) @ extension-worker.js:28
Promise.then (async)
(anonymous) @ extension-worker.js:15
Promise.then (async)
ExtensionWorker @ extension-worker.js:14
(anonymous) @ extension-worker.js:57
(anonymous) @ extension-worker.js:58
__webpack_require__ @ bootstrap:19
(anonymous) @ bootstrap:83
(anonymous) @ bootstrap:83
Can someone please help me?
Also, here is the link to the extension: https://surprise4.github.io/Internet_3.js

Last edited by Gohoski (July 14, 2020 12:53:44)



Помоги с переводом Русской Вики - вот тема
(Help translating the Russian Scratch Wiki - here is the topic)

Hello! I am Gleb and I like programming in JavaScript, C++, Java, and of course, on Scratch.
Check out my website! (not done yet)
F4F: Yes
Be Moist B)‎
Codigador
Scratcher
80 posts

Creating extensions for Scratch 3.0

NitroCipher wrote:

Creating extensions for Scratch 3.0


There is now official documentation regarding extensions!, but feel free to use this post to get you started


You'll want to start off by creating your extension's class, and register the extension - In my case, this would be ‘NitroBlock’

class NitroBlock { //In both instances, NitroBlock will be the name in both instances
}
Scratch.extensions.register(new NitroBlock());

Next, we will be constructing block and menu definitions - We will continue to use ‘NitroBlock’ through this tutorial
getInfo() {
    return {
        "id": "NitroBlock",
        "name": "NitroBlock",
        "blocks": [
        ],
        "menus": { //we will get back to this in a later tutorial
        }
    };
}

We are going to take a look at how blocks are constructed

For those of you that are familiar with extensions for Scratch 2.0, we will start off with this: - If not, you can ignore this
['r', 'letters %n through %n of %s', 'substringy', '2', '5', 'hello world']
//breakdown below:
['r' = block type, 'letters %n through %n of %s' = block text, 'substringy' = block ID/opcode]

{
    "opcode": "substringy", //This will be the ID code for the block
    "blockType": "reporter", //This can either be Boolean, reporter, command, or hat
    "text": "letters [num1] through [num2] of [string]", //This is the block text, and how it will display in the Scratch interface
    "arguments": { //Arguments are the input fields in the block. In the block text, place arguments in square brackets with the corresponding ID 
        "num1": { //This is the ID for your argument
            "type": "number", //This can be either Boolean, number, or string
            "defaultValue": "2" //This is the default text that will appear in the input field, you can leave this blank if you wish
        },
        "num2": {
            "type": "number",
            "defaultValue": "5"
        },
        "string": {
            "type": "string",
            "defaultValue": "hello world"
        }
    }
},

We will put this newly constructed code into the blocks object above - My code will now look like this
class NitroBlock {
    getInfo() {
        return {
            "id": "NitroBlock",
            "name": "NitroBlock",
            "blocks": [{
                    "opcode": "substringy",
                    "blockType": "reporter",
                    "text": "letters [num1] through [num2] of [string]",
                    "arguments": {
                        "num1": {
                            "type": "number",
                            "defaultValue": "2"
                        },
                        "num2": {
                            "type": "number",
                            "defaultValue": "5"
                        },
                        "string": {
                            "type": "string",
                            "defaultValue": "hello world"
                        }
                    }
                },
            }],
        "menus": { //we will get back to this in a later tutorial
        }
    };
}
Scratch.extensions.register(new NitroBlock());

Next we come to the most important part, the code that actually runs the blocks! - I am keeping this short and simple for tutorial's sake.
//Make sure you name this function with with the proper ID for the block you defined above
substringy({num1, num2, string}) { //these names will match the argument names you used earlier, and will be used as the variables in your code
    //this code can be anything you want
    return string.substring(num1 - 1, num2);  //for reporters and Boolean blocks the important thing is to use 'return' to get the value back into Scratch.
}

Place this new code below your getInfo() function
class NitroBlock {
    getInfo() {
        return {
            "id": "NitroBlock",
            "name": "NitroBlock",
            "blocks": [{
                    "opcode": "substringy",
                    "blockType": "reporter",
                    "text": "letters [num1] through [num2] of [string]",
                    "arguments": {
                        "num1": {
                            "type": "number",
                            "defaultValue": "2"
                        },
                        "num2": {
                            "type": "number",
                            "defaultValue": "5"
                        },
                        "string": {
                            "type": "string",
                            "defaultValue": "hello world"
                        }
                    }
                },
            }],
        "menus": { //we will get back to this in a later tutorial
        }
    };
    substringy({num1, num2, string}) {
        return string.substring(num1 - 1, num2);
    };
}

Save this code to your computer as a js file, in my case it is NitroBlock_3.js

Congratz, you now have your extension code created!!
You can use this tutorial to add it your own personal copy of scratch
Or, you can host the extension with gh-pages, and go here to test it
(provide your own url, don't use mine)

Here is the archived copy of my original post
Can you show the resulting block?

I am Codigador, a Scratcher that is a 10 yrs old cool kid and likes programing scratch, python, HTML, JavaScript and building apps with appinventor.
This is my signature. To setup your signature, Select ‘change signature’ on the bottom from the discussion home.
Everything is clickable!
my profile mamma mia with music blocks flappy bird on games account
Scratch - A clicker game A trip aroud the world
PiglinZumbi
Scratcher
17 posts

Creating extensions for Scratch 3.0

Codigador wrote:

NitroCipher wrote:

Creating extensions for Scratch 3.0


There is now official documentation regarding extensions!, but feel free to use this post to get you started


You'll want to start off by creating your extension's class, and register the extension - In my case, this would be ‘NitroBlock’

class NitroBlock { //In both instances, NitroBlock will be the name in both instances
}
Scratch.extensions.register(new NitroBlock());

Next, we will be constructing block and menu definitions - We will continue to use ‘NitroBlock’ through this tutorial
getInfo() {
    return {
        "id": "NitroBlock",
        "name": "NitroBlock",
        "blocks": [
        ],
        "menus": { //we will get back to this in a later tutorial
        }
    };
}

We are going to take a look at how blocks are constructed

For those of you that are familiar with extensions for Scratch 2.0, we will start off with this: - If not, you can ignore this
['r', 'letters %n through %n of %s', 'substringy', '2', '5', 'hello world']
//breakdown below:
['r' = block type, 'letters %n through %n of %s' = block text, 'substringy' = block ID/opcode]

{
    "opcode": "substringy", //This will be the ID code for the block
    "blockType": "reporter", //This can either be Boolean, reporter, command, or hat
    "text": "letters [num1] through [num2] of [string]", //This is the block text, and how it will display in the Scratch interface
    "arguments": { //Arguments are the input fields in the block. In the block text, place arguments in square brackets with the corresponding ID 
        "num1": { //This is the ID for your argument
            "type": "number", //This can be either Boolean, number, or string
            "defaultValue": "2" //This is the default text that will appear in the input field, you can leave this blank if you wish
        },
        "num2": {
            "type": "number",
            "defaultValue": "5"
        },
        "string": {
            "type": "string",
            "defaultValue": "hello world"
        }
    }
},

We will put this newly constructed code into the blocks object above - My code will now look like this
class NitroBlock {
    getInfo() {
        return {
            "id": "NitroBlock",
            "name": "NitroBlock",
            "blocks": [{
                    "opcode": "substringy",
                    "blockType": "reporter",
                    "text": "letters [num1] through [num2] of [string]",
                    "arguments": {
                        "num1": {
                            "type": "number",
                            "defaultValue": "2"
                        },
                        "num2": {
                            "type": "number",
                            "defaultValue": "5"
                        },
                        "string": {
                            "type": "string",
                            "defaultValue": "hello world"
                        }
                    }
                },
            }],
        "menus": { //we will get back to this in a later tutorial
        }
    };
}
Scratch.extensions.register(new NitroBlock());

Next we come to the most important part, the code that actually runs the blocks! - I am keeping this short and simple for tutorial's sake.
//Make sure you name this function with with the proper ID for the block you defined above
substringy({num1, num2, string}) { //these names will match the argument names you used earlier, and will be used as the variables in your code
    //this code can be anything you want
    return string.substring(num1 - 1, num2);  //for reporters and Boolean blocks the important thing is to use 'return' to get the value back into Scratch.
}

Place this new code below your getInfo() function
class NitroBlock {
    getInfo() {
        return {
            "id": "NitroBlock",
            "name": "NitroBlock",
            "blocks": [{
                    "opcode": "substringy",
                    "blockType": "reporter",
                    "text": "letters [num1] through [num2] of [string]",
                    "arguments": {
                        "num1": {
                            "type": "number",
                            "defaultValue": "2"
                        },
                        "num2": {
                            "type": "number",
                            "defaultValue": "5"
                        },
                        "string": {
                            "type": "string",
                            "defaultValue": "hello world"
                        }
                    }
                },
            }],
        "menus": { //we will get back to this in a later tutorial
        }
    };
    substringy({num1, num2, string}) {
        return string.substring(num1 - 1, num2);
    };
}

Save this code to your computer as a js file, in my case it is NitroBlock_3.js

Congratz, you now have your extension code created!!
You can use this tutorial to add it your own personal copy of scratch
Or, you can host the extension with gh-pages, and go here to test it
(provide your own url, don't use mine)

Here is the archived copy of my original post
Can you show the resulting block?
The result block is:
NitroBlock

Last edited by PiglinZumbi (July 20, 2020 19:22:45)

AshtonDrye
Scratcher
41 posts

Creating extensions for Scratch 3.0



I AM A GNOME AND YOU BEEN GNOMED

Powered by DjangoBB