Discuss Scratch

lucianocefet
New to Scratch
3 posts

Creating extensions for Scratch 3.0

Obrigado pelo post, me ajudou bastante
E realmente fica mais fácil de entender, estou eletrizado, rsrsrs
NitroCipher
Scratcher
500+ posts

Creating extensions for Scratch 3.0

lucianocefet wrote:

Thanks for the post, it helped me a lot
And it really gets easier to understand, I'm electrified, lol
warning, google translated, may not be entirely accurate

You're welcome! Do you have any questions?

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

Current project: [s3Blocks: scratchblocks rewritten for Scratch 3.0] ::#4b4a60 //https://scratch.mit.edu/discuss/topic/290031/ Basically done!
This is my signature identifier “aWFtbml0cm9jaXBoZXI=”
NitroCipher
Scratcher
500+ 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.

I was trying to modify the pen extension and I added my own custom url, but when I try to pull up the page (nitrocipher.github.io/scratch-gui/develop) it does seem to recognize the changes I made to index.js

I know you got this to work, so i am wondering if i just somehow missed a step or something

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

Current project: [s3Blocks: scratchblocks rewritten for Scratch 3.0] ::#4b4a60 //https://scratch.mit.edu/discuss/topic/290031/ Basically done!
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.

I was trying to modify the pen extension and I added my own custom url, but when I try to pull up the page (nitrocipher.github.io/scratch-gui/develop) it does seem to recognize the changes I made to index.js

I know you got this to work, so i am wondering if i just somehow missed a step or something
The URL you used is not the file, but the GitHub page listing the file. Rather than using the URL https://github.com/NitroCipher/scratch-gui/blob/develop/src/lib/libraries/extensions/pen2.js, use the URL https://raw.githubusercontent.com/NitroCipher/scratch-gui/develop/src/lib/libraries/extensions/pen2.js. That should hopefully fix it!
AnimatorsParadise
Scratcher
1000+ posts

Creating extensions for Scratch 3.0

I've got an idea for one. This is a random block that I just got bored so gonna see if it draws a block. {
opcode: ‘example-noop’,
blockType: Scratch.BlockType.COMMAND,
blockAllThreads: false,
text: ‘Supercalifragilistexpialadocious’,
func: ‘noop’
},

derpyd1amonds
Scratcher
13 posts

Creating extensions for Scratch 3.0

Hi ap!
FlinxtheCat
Scratcher
100+ posts

Creating extensions for Scratch 3.0

discoverypark wrote:

How about if you could make your own extensions? (in scratch 3.0)


Yay that would be cool,but it will cost a lot of work to do for them.

My Scartch Profile
ScratchDiogoh
Scratcher
1000+ posts

Creating extensions for Scratch 3.0

Hello!
Pen :: pen
MIDI :: sound
Video Sensing :: sensing
They are extensions on Scartch 3.0

Last edited by ScratchDiogoh (April 25, 2018 09:34:09)


+1700 Bad Posts
ScratchDiogoh
Scratcher
1000+ posts

Creating extensions for Scratch 3.0

ScratchX is
The Scratch Team in 3.0 beta put the extensions of ScratchX

+1700 Bad Posts
JGames101
Scratcher
100+ posts

Creating extensions for Scratch 3.0

FlinxtheCat wrote:

discoverypark wrote:

How about if you could make your own extensions? (in scratch 3.0)


Yay that would be cool,but it will cost a lot of work to do for them.

My Scartch Profile
JavaScript can be run from extensions, so it is a possibility… it depends on where the code is run, and how open the system is. I'll look into it.
NitroCipher
Scratcher
500+ posts

Creating extensions for Scratch 3.0

JGames101 wrote:

FlinxtheCat wrote:

discoverypark wrote:

How about if you could make your own extensions? (in scratch 3.0)


Yay that would be cool,but it will cost a lot of work to do for them.

My Scartch Profile
JavaScript can be run from extensions, so it is a possibility… it depends on where the code is run, and how open the system is. I'll look into it.

It would be a pain in the butt, but it might be possible for us to write a ScratchX to Ex3.0 conversion script.

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

Current project: [s3Blocks: scratchblocks rewritten for Scratch 3.0] ::#4b4a60 //https://scratch.mit.edu/discuss/topic/290031/ Basically done!
This is my signature identifier “aWFtbml0cm9jaXBoZXI=”
ScratchDiogoh
Scratcher
1000+ posts

Creating extensions for Scratch 3.0

Hello!
When Lego [ We Do 2.0 v] is on :: extension hat
<Lego[We Do 2.0 v]:: extension>
turn cw () degrees :: extension

turn motor power to (200) :: extension
(motor power :: extension )
... :: extension


+1700 Bad Posts
NitroCipher
Scratcher
500+ posts

Creating extensions for Scratch 3.0

ScratchDiogoh wrote:

Hello!
When Lego [ We Do 2.0 v] is on :: extension hat
<Lego[We Do 2.0 v]:: extension>
turn cw () degrees :: extension

turn motor power to (200) :: extension
(motor power :: extension )
... :: extension


The Scratch Team is working on implementing the Lego WeDo along with Mindstorms EV3, and Lego Boost. This is a topic discussing the new 3.0 extension format, please do not blockspam

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

Current project: [s3Blocks: scratchblocks rewritten for Scratch 3.0] ::#4b4a60 //https://scratch.mit.edu/discuss/topic/290031/ Basically done!
This is my signature identifier “aWFtbml0cm9jaXBoZXI=”
ScratchDiogoh
Scratcher
1000+ posts

Creating extensions for Scratch 3.0

NitroCipher wrote:

ScratchDiogoh wrote:

Hello!
When Lego [ We Do 2.0 v] is on :: extension hat
<Lego[We Do 2.0 v]:: extension>
turn cw () degrees :: extension

turn motor power to (200) :: extension
(motor power :: extension )
... :: extension


The Scratch Team is working on implementing the Lego WeDo along with Mindstorms EV3, and Lego Boost. This is a topic discussing the new 3.0 extension format, please do not blockspam
Thank You NitroCipher by the infomation ☁

+1700 Bad Posts
FrankWine
Scratcher
2 posts

Creating extensions for Scratch 3.0

Hi all,
I'm new in this discussion. I'm a teacher at middle school in Italy. I'm really interested in creating a new open Scratch 3.0 extension for Arduino.
I usually teach in coding classes for children from 11 to 15 (using Scratch) and last time I created a modified extension for Arduino from mBlock.
I'd like to have a simple basic Arduino Extension where I could write and add all the blocks I need (sensors, motors, lights, etc.). I'm a programmer too.

I've already read all the FAQ about Scratch 3.0 project, but no sign about Arduino. I know that most of ScratchX will be ported into 3.0 but I'd like to know if there's something going on about Arduino.

Thank you.
Francesco
NitroCipher
Scratcher
500+ posts

Creating extensions for Scratch 3.0

FrankWine wrote:

Hi all,
I'm new in this discussion. I'm a teacher at middle school in Italy. I'm really interested in creating a new open Scratch 3.0 extension for Arduino.
I usually teach in coding classes for children from 11 to 15 (using Scratch) and last time I created a modified extension for Arduino from mBlock.
I'd like to have a simple basic Arduino Extension where I could write and add all the blocks I need (sensors, motors, lights, etc.). I'm a programmer too.

I've already read all the FAQ about Scratch 3.0 project, but no sign about Arduino. I know that most of ScratchX will be ported into 3.0 but I'd like to know if there's something going on about Arduino.

Thank you.
Francesco

Hey Frank, thanks for the question. Scratch 3.0 isn't readily open for extensions at the moment (and 3.0 is a bit unstable), so for right now I would recommend sticking with ScratchX for arduino use. I would love to see an arduino extension made with 3.0 in mind, but that is still probably a while away. I am in the extremely early stages of writing a program to convert extensions from 2.0 to 3.0, and I will try to keep this thread updated about that.

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

Current project: [s3Blocks: scratchblocks rewritten for Scratch 3.0] ::#4b4a60 //https://scratch.mit.edu/discuss/topic/290031/ Basically done!
This is my signature identifier “aWFtbml0cm9jaXBoZXI=”
FrankWine
Scratcher
2 posts

Creating extensions for Scratch 3.0

NitroCipher wrote:

FrankWine wrote:

Hi all,
I'm new in this discussion. I'm a teacher at middle school in Italy. I'm really interested in creating a new open Scratch 3.0 extension for Arduino.
I usually teach in coding classes for children from 11 to 15 (using Scratch) and last time I created a modified extension for Arduino from mBlock.
I'd like to have a simple basic Arduino Extension where I could write and add all the blocks I need (sensors, motors, lights, etc.). I'm a programmer too.

I've already read all the FAQ about Scratch 3.0 project, but no sign about Arduino. I know that most of ScratchX will be ported into 3.0 but I'd like to know if there's something going on about Arduino.

Thank you.
Francesco

Hey Frank, thanks for the question. Scratch 3.0 isn't readily open for extensions at the moment (and 3.0 is a bit unstable), so for right now I would recommend sticking with ScratchX for arduino use. I would love to see an arduino extension made with 3.0 in mind, but that is still probably a while away. I am in the extremely early stages of writing a program to convert extensions from 2.0 to 3.0, and I will try to keep this thread updated about that.

Hi NitroCipher,
thanks a lot for your answer. I'll wait for any update will be posted about 3.0 extensions. I'm really excited about Scratch 3.0!
st21loga
Scratcher
2 posts

Creating extensions for Scratch 3.0

(☁ ☁)
JGames101
Scratcher
100+ posts

Creating extensions for Scratch 3.0

Oh wow, extensions have changed a lot.
I guess that's why they recommend to not use pre-release software too much…

I was trying to create another basic extension in Scratch 3, just using the speech synthesis api to say whatever you enter, but I ran into a lot of problems.
First problem: After copying the example extension, and writing my extension, I went over to set the extensionURL for my extension, but discovered something that shocked me to my core…
extensionURL has become extensionId!!!!!
So I replaced the pen extension with my new one to make my life easier. Then, I realized…
The extension format has completely changed.
Well, quite a bit, anyway.

So… the basic way that it now works is that we have a class. This class has a constructor to setup the extension, a “getInfo” function to return whatever information for the extension (similar to how it was defined before), and then any functions for the blocks. You need to use require() to import some things for it to work. It doesn't sound that big, and it shouldn't be too hard to port from the older format, but still, It's pretty different.

Here's the new format (with the new google translate extension).

I'm getting weird errors right now, to do with event dispatches needing to be strings in a completely different file… but I'll update if I get any breakthroughs.

Last edited by JGames101 (June 17, 2018 04:12:12)

NitroCipher
Scratcher
500+ posts

Creating extensions for Scratch 3.0

JGames101 wrote:

Oh wow, extensions have changed a lot.
I guess that's why they recommend to not use pre-release software too much…

I was trying to create another basic extension in Scratch 3, just using the speech synthesis api to say whatever you enter, but I ran into a lot of problems.
First problem: After copying the example extension, and writing my extension, I went over to set the extensionURL for my extension, but discovered something that shocked me to my core…
extensionURL has become extensionId!!!!!
So I replaced the pen extension with my new one to make my life easier. Then, I realized…
The extension format has completely changed.
Well, quite a bit, anyway.

So… the basic way that it now works is that we have a class. This class has a constructor to setup the extension, a “getInfo” function to return whatever information for the extension (similar to how it was defined before), and then any functions for the blocks. You need to use require() to import some things for it to work. It doesn't sound that big, and it shouldn't be too hard to port from the older format, but still, It's pretty different.

Here's the new format (with the new google translate extension).

I'm getting weird errors right now, to do with event dispatches needing to be strings in a completely different file… but I'll update if I get any breakthroughs.

Welp, it looks like i'm going to have some more fun trying to write a converter than I thought I will probably hold off until the ST finally finalizes their formatting. Thanks for the update!

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

Current project: [s3Blocks: scratchblocks rewritten for Scratch 3.0] ::#4b4a60 //https://scratch.mit.edu/discuss/topic/290031/ Basically done!
This is my signature identifier “aWFtbml0cm9jaXBoZXI=”

Powered by DjangoBB