Discuss Scratch

zachary123212
Scratcher
1 post

Creating extensions for Scratch 3.0

Well, after an exhausting amount of backtracking, I've managed to get the new version of scratch to add a local extension, but still can't figure out how to get it to work with URLs. What I've done is this (say you want to add an extension named X):
  1. fork, clone, and link the scratch-vm and scratch-gui repos
  2. in scratch-vm/src/extensions add a directory called X, containing your extension's index.js file, and any relevant assets
  3. in scratch-vm/src/extension-support/extension-manager.js, near the top of the file, add the line:
    const Scratch3XBlocks = require('../extensions/X');
  4. a bit further down, at the end of const builtinExtensions, add the line (with the requisite comma preceding it):
    X: Scratch3XBlocks
  5. go to scratch-gui/src/lib/libraries/extensions/index.jsx and add an entry with X as extensionId

Does anyone know how to pass in a remote URL directly in index.jsx, so I don't need to repeat steps 1-4?
A48c
Scratcher
100+ posts

Creating extensions for Scratch 3.0

discoverypark wrote:

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

Hello, I'm a employee of the The Speed-Shop
LuckyLucky7
Scratcher
1000+ posts

Creating extensions for Scratch 3.0

kyleplo wrote:

Try this: https://github.com/kyleplo/scratch-three-extension-docs/wiki/Getting-Started
Seems pretty neat. Maybe I can experiment with this and probably add this to my mod.

I have about 3450 posts, 90 shared projects, 180 total created/followed topics, and 425 followers.

Sheep_maker
Scratcher
1000+ posts

Creating extensions for Scratch 3.0

I've modified scratch-gui and added a button in the extensions library that loads extensions from a URL.

Most of the functionality seems to have already been put in place; they just haven't added a button for it yet.

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.

I made an extension with a few reporter blocks here.

Edit: updated URL because the builder was being disobedient.

Last edited by Sheep_maker (July 10, 2018 11:58:28)


- 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; }
LuckyLucky7
Scratcher
1000+ posts

Creating extensions for Scratch 3.0

Sheep_maker wrote:

I've modified scratch-gui and added a button in the extensions library that loads extensions from a URL.

Most of the functionality seems to have already been put in place; they just haven't added a button for it yet.

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.

I made an extension with a few reporter blocks here.
Looks like I'll use this extension to test out the blocks for my Lucky7 Mod.

I have about 3450 posts, 90 shared projects, 180 total created/followed topics, and 425 followers.

dalelane
Scratcher
6 posts

Creating extensions for Scratch 3.0

Sheep_maker wrote:

I've modified scratch-gui and added a button in the extensions library that loads extensions from a URL.

Thanks so much for sharing this. This (and this issue in particular) looks like it'll be exactly what I need to try and port my Scratchx work over to Scratch 3. Looking forward to giving it a try :-)
OnMax
Scratcher
51 posts

Creating extensions for Scratch 3.0

Hello there.
Thanks for creating this topic, it was really helpful!
I'm now working on the “Firebase Database Extension”. It is a Google's realtime Database. I need first ask for Google's permission and then I'll start working. Here are some blocks for extensions:
add value key [name] value [Alex]::pen

(get value key [name]::pen)

get all keys to list [my list v] ::pen

push value from list [my list v] ::pen

Thanks again

… i guess, i just do something here
OnMax
Scratcher
51 posts

Creating extensions for Scratch 3.0

Please, help!

I need help with this extension ! I wrote simple alert display extension and I used Sheep_maker's scratch guitar with load URL. What wrong with it? Please help!!!

… i guess, i just do something here
Sheep_maker
Scratcher
1000+ posts

Creating extensions for Scratch 3.0

OnMax wrote:

Please, help!

I need help with this extension ! I wrote simple alert display extension and I used Sheep_maker's scratch guitar with load URL. What wrong with it? Please help!!!
It's Scratch.BlockType.STRING, not Scratch.blockType.STRING

- 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:

OnMax wrote:

Please, help!

I need help with this extension ! I wrote simple alert display extension and I used Sheep_maker's scratch guitar with load URL. What wrong with it? Please help!!!
It's Scratch.BlockType.STRING, not Scratch.blockType.STRING
Thanks a lot! I often make mistakes in JavaScript with register

… i guess, i just do something here
OnMax
Scratcher
51 posts

Creating extensions for Scratch 3.0

Sheep_maker wrote:

OnMax wrote:

Please, help!

I need help with this extension ! I wrote simple alert display extension and I used Sheep_maker's scratch guitar with load URL. What wrong with it? Please help!!!
It's Scratch.BlockType.STRING, not Scratch.blockType.STRING
I now know where's the error. There must be not blockType. There must be ArgumentType. Thanks everyone

… i guess, i just do something here
OnMax
Scratcher
51 posts

Creating extensions for Scratch 3.0

Hi, guys.

I started working with TextToSpeech extension that uses that code:

window.speechSynthesis.speak();

Last edited by OnMax (Aug. 1, 2018 14:21:41)


… i guess, i just do something here
OnMax
Scratcher
51 posts

Creating extensions for Scratch 3.0

NOW I REALLY NEED HELP!

Guys, please tell me, what's wrong with this extension?

Actually, it works fine and all the reporters and basic functions are working. But I wrote…

44 speechsay({TEXT}) {
45 sayedtxt = TEXT;
46 var msg = new SpeechSynthesisUtterance(TEXT);
47 window.speechSynthesis.speak(msg);
48 }


…and the speech command (47) doesn't works!

Please tell me, what's wrong with this, because everything works fine, exept of the speech.

P.S: Also, the speech script works in the simple HTML page, but not in the Scratch 3.0 GUI with url button.

Last edited by OnMax (Aug. 1, 2018 14:22:34)


… i guess, i just do something here
Sheep_maker
Scratcher
1000+ posts

Creating extensions for Scratch 3.0

OnMax wrote:

Hi, guys.

I started working with TextToSpeech extension that uses that code:

window.speechSynthesis.speak();

Extensions are run in their own worker; window does not exist in workers, they use self.

- 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:

OnMax wrote:

Hi, guys.

I started working with TextToSpeech extension that uses that code:

window.speechSynthesis.speak();

Extensions are run in their own worker; window does not exist in workers, they use self.
Do you mean, I can just use self instead of window?

… i guess, i just do something here
PullJosh
Scratcher
1000+ posts

Creating extensions for Scratch 3.0

OnMax wrote:

Sheep_maker wrote:

OnMax wrote:

Hi, guys.

I started working with TextToSpeech extension that uses that code:

window.speechSynthesis.speak();

Extensions are run in their own worker; window does not exist in workers, they use self.
Do you mean, I can just use self instead of window?
Haven't tested myself, but it looks like yes.
OnMax
Scratcher
51 posts

Creating extensions for Scratch 3.0

PullJosh wrote:

OnMax wrote:

Sheep_maker wrote:

OnMax wrote:

Hi, guys.

I started working with TextToSpeech extension that uses that code:

window.speechSynthesis.speak();

Extensions are run in their own worker; window does not exist in workers, they use self.
Do you mean, I can just use self instead of window?
Haven't tested myself, but it looks like yes.
Thanks, PullJosh. I'll try it

… i guess, i just do something here
OnMax
Scratcher
51 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

… i guess, i just do something here
SimpleScratch
Scratcher
500+ 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


Powered by DjangoBB