Discuss Scratch

lktornado360
Scratcher
35 posts

Creating extensions for Scratch 3.0

lktornado360 wrote:

How do you download the code as a .js?
Plz help someone

“Heluim is inert, it does not react to anything. This makes it perfect to help create a safe atmosphere for welding.” & “Atomic Number: 2; Formula: He; Atomic Weight: 4.002602; State at 20° C: gas; Boiling point: -268.928° C; Melting point: unknown; % in the Universe: 23; % in the Earth's crust: 0.00000055; % in Earths's oceans: 0.00000000072; % in humans: none.”
–The Periodic Table by Sean Callery and Miranda Smith

lktornado360
Scratcher
35 posts

Creating extensions for Scratch 3.0

SOMEONE HELP ME

“Heluim is inert, it does not react to anything. This makes it perfect to help create a safe atmosphere for welding.” & “Atomic Number: 2; Formula: He; Atomic Weight: 4.002602; State at 20° C: gas; Boiling point: -268.928° C; Melting point: unknown; % in the Universe: 23; % in the Earth's crust: 0.00000055; % in Earths's oceans: 0.00000000072; % in humans: none.”
–The Periodic Table by Sean Callery and Miranda Smith

sephiroth76
New to Scratch
14 posts

Creating extensions for Scratch 3.0

_nix wrote:

sephiroth76 wrote:

_nix wrote:

Extensions actually can read data from sprites. Use the “util.target” variable:
myExtensionFunction (util) {
    const {x, y} = util.target;
    // etc
}

If you want to access data for every sprite, use “vm.runtime.targets”:
const sprites = vm.targets.filter(target => !target.isStage);
const data = sprites.map(sprite => ({x: sprite.x, y: sprite.x});
sendData(data); // or whatever your code is :P

to use this code do I have to import something?
This gave me this error:
Warning: Failed prop type: Invalid prop `monitors` of type `OrderedMap` supplied to `MonitorList`, expected instance of `OrderedMap`.

I believe that warning is actually normal (it's a bug in the current version of scratch-gui). You can ignore it. If your code isn't working, you'll need to share the full extension file here (and an explanation of what you want it to do, and what's actually happening instead).

BTW, you can use the tag [code] to format text like code (monospace):
[code]
...
[/code]
I use sheeptester to test the extension, not the local development version from github. may be this is because that code doesn't work
sephiroth76
New to Scratch
14 posts

Creating extensions for Scratch 3.0

lktornado360 wrote:

How do you download the code as a .js?
your question is not so clear.
you can download the full source code of scratch3 (js) from this: link https://github.com/LLK/
however, you can test your js extension here
https://sheeptester.github.io/scratch-gui/?url=https://sheeptester.github.io/javascripts/Nitroblocks.js
if you are developing an extension and you don't want to fork locally your scratch3 app.

Last edited by sephiroth76 (May 27, 2019 09:56:23)

lktornado360
Scratcher
35 posts

Creating extensions for Scratch 3.0

sephiroth76 wrote:

lktornado360 wrote:

How do you download the code as a .js?
your question is not so clear.
you can download the full source code of scratch3 (js) from this: link https://github.com/LLK/
however, you can test your js extension here
https://sheeptester.github.io/scratch-gui/?url=https://sheeptester.github.io/javascripts/Nitroblocks.js
if you are developing an extension and you don't want to fork locally your scratch3 app.
I mean like how to first guy said

NitroCipher wrote:

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

“Heluim is inert, it does not react to anything. This makes it perfect to help create a safe atmosphere for welding.” & “Atomic Number: 2; Formula: He; Atomic Weight: 4.002602; State at 20° C: gas; Boiling point: -268.928° C; Melting point: unknown; % in the Universe: 23; % in the Earth's crust: 0.00000055; % in Earths's oceans: 0.00000000072; % in humans: none.”
–The Periodic Table by Sean Callery and Miranda Smith

cawdd
Scratcher
100+ posts

Creating extensions for Scratch 3.0

AmazingMech2418 wrote:

I actually found stuff like this on the Scratch 3.0 source code extension example. How do you add an extension to a project in Scratch 3?

Oof #34c9eb
Jonathan50
Scratcher
1000+ posts

Creating extensions for Scratch 3.0

The documentation for the extension interface is now here.

All of the extensions provided by Scratch are “internal extensions”. The rest will run in ridiculous web workers.

Last edited by Jonathan50 (June 3, 2019 04:05:01)

The_Imagineer_
Scratcher
100+ posts

Creating extensions for Scratch 3.0

but how would you run it

「✦」@The_Imagineer_「✦」
「❖」Stressed Depressed Lemon Zest「❖」
chop2008
Scratcher
14 posts

Creating extensions for Scratch 3.0

I had no idea that you can make custom scratch extensions. Thanks for this new change. can you publish your scratch projects with custom extensions?
chop2008
Scratcher
14 posts

Creating extensions for Scratch 3.0

Last edited by chop2008 (June 23, 2019 02:50:13)

lktornado360
Scratcher
35 posts

Creating extensions for Scratch 3.0

chop2008 wrote:

I had no idea that you can make custom scratch extensions. Thanks for this new change. can you publish your scratch projects with custom extensions?
Not yet

“Heluim is inert, it does not react to anything. This makes it perfect to help create a safe atmosphere for welding.” & “Atomic Number: 2; Formula: He; Atomic Weight: 4.002602; State at 20° C: gas; Boiling point: -268.928° C; Melting point: unknown; % in the Universe: 23; % in the Earth's crust: 0.00000055; % in Earths's oceans: 0.00000000072; % in humans: none.”
–The Periodic Table by Sean Callery and Miranda Smith

KimPlayz4LK
Scratcher
6 posts

Creating extensions for Scratch 3.0

To make it in .js file, click on File on the top, download, and when the PC will ask you where save it, enter:
'File.js'. The .js is wery important, because it showing the format of the file.
Soo, try it. But i tryed it, and look what happened! All was not in javascript! You'll see… Good luck!
Jonathan50
Scratcher
1000+ posts

Creating extensions for Scratch 3.0

KimPlayz4LK wrote:

To make it in .js file, click on File on the top, download, and when the PC will ask you where save it, enter:
'File.js'. The .js is wery important, because it showing the format of the file.
Soo, try it. But i tryed it, and look what happened! All was not in javascript! You'll see… Good luck!
Scratch projects are not JavaScript code. To make a Scratch extension, you will want to write it in a text editor like Notepad (which comes with Windows) or TextEdit (which comes with macOS.) You could learn JavaScript here.
KimPlayz4LK
Scratcher
6 posts

Creating extensions for Scratch 3.0

Sorry, but i know JavaScript little bit… But more.
VietnamScratchTeam
Scratcher
1 post

Creating extensions for Scratch 3.0

<[library] = [liBRARY]>
fruccolo
Scratcher
1 post

Creating extensions for Scratch 3.0

Hello to everybody,
I'm tryingo to develop an extension for a device that has inside Arduino and i'd want to open a socket with it. I have some trouble to require npm module like socket.io. In wich folder i have to execute the npm install command to find the module with require('socket.io') string?

Last edited by fruccolo (July 1, 2019 13:08:15)

Jonathan50
Scratcher
1000+ posts

Creating extensions for Scratch 3.0

fruccolo wrote:

Hello to everybody,
I'm tryingo to develop an extension for a device that has inside Arduino and i'd want to open a socket with it. I have some trouble to require npm module like socket.io. In wich folder i have to execute the npm install command to find the module with require('socket.io') string?
I guess you're writing both a client Scratch extension and a Node.js server which it must be used with? This tutorial has the details on how to make a server using Socket.IO; you can just make a folder for your extension and install the Socket.IO server there. In the client you should hopefully be able to load the Socket.IO client with something along the lines of
importScripts('/socket.io/socket.io.js')
but with the correct URL.
psicinfoscratch
New to Scratch
8 posts

Creating extensions for Scratch 3.0

NitroCipher wrote:

…you have to your own url for the extension. In your case it would be https://sheeptester.github.io/scratch-gui/?url=https://cottignolima.github.io/scratch_extension/test.js
Hi,
I've tried, just to test the structure, to take the same js file, and called https://sheeptester.github.io/scratch-gui/?url=https://raw.githubusercontent.com/sarini68/hello-world/master/tests1.js but nothing happens, while if I call
https://sheeptester.github.io/scratch-gui/?url=https://nitrocipher.github.io/ext2to3/ext-test.js? it works.
Could you please explain to me why? thanks
Sheep_maker
Scratcher
1000+ posts

Creating extensions for Scratch 3.0

psicinfoscratch wrote:

NitroCipher wrote:

…you have to your own url for the extension. In your case it would be https://sheeptester.github.io/scratch-gui/?url=https://cottignolima.github.io/scratch_extension/test.js
Hi,
I've tried, just to test the structure, to take the same js file, and called https://sheeptester.github.io/scratch-gui/?url=https://raw.githubusercontent.com/sarini68/hello-world/master/tests1.js but nothing happens, while if I call
https://sheeptester.github.io/scratch-gui/?url=https://nitrocipher.github.io/ext2to3/ext-test.js? it works.
Could you please explain to me why? thanks
According to the console, its MIME type is text/plain instead of text/javascript, so the browser thinks it isn't a JS file that should be executed (for security reasons)

You should turn on Github pages in your repository settings (Options > Github Pages > set Source to “master branch”), and then it should work if you use https://sarini68.github.io/hello-world/tests1.js

- Sheep_maker This is a kumquat-free signature. :P
What's happening? This is my signature; it appears below all my posts. Discuss it on my profile, not the forums.
To make your own, click “Change your signature” at the bottom of the discussion home page.

If you have nothing to add, don't post!
.postsignature { overflow: auto; } .scratchblocks { overflow-x: auto; overflow-y: hidden; }
psicinfoscratch
New to Scratch
8 posts

Creating extensions for Scratch 3.0

Sheep_maker wrote:

psicinfoscratch wrote:

NitroCipher wrote:

…you have to your own url for the extension. In your case it would be https://sheeptester.github.io/scratch-gui/?url=https://cottignolima.github.io/scratch_extension/test.js
Hi,
I've tried, just to test the structure, to take the same js file, and called https://sheeptester.github.io/scratch-gui/?url=https://raw.githubusercontent.com/sarini68/hello-world/master/tests1.js but nothing happens, while if I call
https://sheeptester.github.io/scratch-gui/?url=https://nitrocipher.github.io/ext2to3/ext-test.js? it works.
Could you please explain to me why? thanks
According to the console, its MIME type is text/plain instead of text/javascript, so the browser thinks it isn't a JS file that should be executed (for security reasons)

You should turn on Github pages in your repository settings (Options > Github Pages > set Source to “master branch”), and then it should work if you use https://sarini68.github.io/hello-world/tests1.js

Now it works, thanks!
Could I ask you why apparently some of your blocks (from the example https://nitrocipher.github.io/ext2to3/ext-test.js? ) do not return anything? I am intending, in particular, “javascript”, “prompt user with” and “get data from url”

Powered by DjangoBB

Standard | Mobile