Discuss Scratch
- Discussion Forums
- » Open Source Projects
- » How to get Scratch to JavaScript? Support us now!
- sausagescratch
-
40 posts
How to get Scratch to JavaScript? Support us now!
Hi guys, thanks for checking out my forum post!
I've been in contact with many Scratchers recently big and small, they all have something very similar, they love Scratch and want a program that will convert your Scratch project to JavaScript! Many of you may think this is hard, many of you experienced programmers may think this is easy but what we really need to do is get it done!
Here's my plan of what this converter would be like: It would be a website where you would type in your projects link you want to convert then press convert, it would take a look at the blocks and their JavaScript sources it would then put all the blocks javascript sources in the order of the blocks and give it to you as a download/multiple downloads which had the JavaScript in a text editor, you could then change any parts you want and you'd be free to use it outside of Scratch!
I'd greatly appreciate if anyone would set to work on this as it is something many Scratchers want to use, it would be really helpful! Please suggest any ideas below or tell me here if you will make it for Scratch if possible!
Thanks @sausagescratch!
The owner and creator of Scratch Radio 1
I've been in contact with many Scratchers recently big and small, they all have something very similar, they love Scratch and want a program that will convert your Scratch project to JavaScript! Many of you may think this is hard, many of you experienced programmers may think this is easy but what we really need to do is get it done!
Here's my plan of what this converter would be like: It would be a website where you would type in your projects link you want to convert then press convert, it would take a look at the blocks and their JavaScript sources it would then put all the blocks javascript sources in the order of the blocks and give it to you as a download/multiple downloads which had the JavaScript in a text editor, you could then change any parts you want and you'd be free to use it outside of Scratch!
I'd greatly appreciate if anyone would set to work on this as it is something many Scratchers want to use, it would be really helpful! Please suggest any ideas below or tell me here if you will make it for Scratch if possible!
Thanks @sausagescratch!
The owner and creator of Scratch Radio 1
Thanks for your collaboration! Please check out my profile for more fun, Scratch Radio 1 is also great so see you there!
- ilovericebubbles
-
100+ posts
How to get Scratch to JavaScript? Support us now!
outside of Scratch!You would probably have to credit Scratch, but nice Idea! you could then change any parts you want and you'd be free to use it
I will try to create something to convert Scratch JSON -> Pseudocode.
when OSWars [5 v] starts :: events hat
cheer [@-BlueOS-] :: looks
- ilovericebubbles
-
100+ posts
How to get Scratch to JavaScript? Support us now!
I'm coming across a problem. I have the variable ‘json’ as the contents of the project.JSON file inside an sb3.outside of Scratch!You would probably have to credit Scratch, but nice Idea! you could then change any parts you want and you'd be free to use it
I will try to create something to convert Scratch JSON -> Pseudocode.
But when I reference a block in the first sprite (the 0th sprite is stage), it comes up with an error.
Here is the reference:
obj.targets[1].blocks.4$mzqKS$7Y`Nr}jjP1f;
the problem is that Scratch identifies blocks as random strings. This contains many reserved characters such as ` , ; and } .
I (for some reason) cannot do \` and \; and \} because it complains about invalid escaping, I cannot do \x64 and such, and I cannot reference it in a string. Good luck figuring it out!
P.S. Yes this is JavaScript in case you forget!
P.P.S Yes I call it ‘JavaScript’ and not ‘Javascript’ or ‘javascript’ or ‘JS’ or ‘js’
P.P.P.S Do you have a problem with that?
P.P.P.P.S Why am I doing this?
Last edited by ilovericebubbles (Nov. 18, 2019 06:47:05)
when OSWars [5 v] starts :: events hat
cheer [@-BlueOS-] :: looks
- ilovericebubbles
-
100+ posts
How to get Scratch to JavaScript? Support us now!
Bump.
when OSWars [5 v] starts :: events hat
cheer [@-BlueOS-] :: looks
- Sheep_maker
-
1000+ posts
How to get Scratch to JavaScript? Support us now!
You can do But when I reference a block in the first sprite (the 0th sprite is stage), it comes up with an error.
Here is the reference:obj.targets[1].blocks.4$mzqKS$7Y`Nr}jjP1f;
the problem is that Scratch identifies blocks as random strings. This contains many reserved characters such as ` , ; and } .
obj.targets[1].blocks['4$mzqKS$7Y`Nr}jjP1f'];
- 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.

.postsignature { overflow: auto; } .scratchblocks { overflow-x: auto; overflow-y: hidden; }
- ilovericebubbles
-
100+ posts
How to get Scratch to JavaScript? Support us now!
Thanks!You can do But when I reference a block in the first sprite (the 0th sprite is stage), it comes up with an error.
Here is the reference:obj.targets[1].blocks.4$mzqKS$7Y`Nr}jjP1f;
the problem is that Scratch identifies blocks as random strings. This contains many reserved characters such as ` , ; and } .obj.targets[1].blocks['4$mzqKS$7Y`Nr}jjP1f'];
when OSWars [5 v] starts :: events hat
cheer [@-BlueOS-] :: looks
- Centuriasoft
-
45 posts
How to get Scratch to JavaScript? Support us now!
The nice thing about trying to convert Scratch projects to javascript files is that Scratch projects are stored as JSON files, aka JavaScript Object Notation, the hard part is that scratch's JSON files are a convoluted mess
Also, I'm making my own programming language so there are a few things I've learnt, one is this: You can't just ‘translate’ from one language (Scratch) to another (JS) without considerable effort. You have to break down the scratch program into tokens, create an AST, and then reverse that AST into JS code
Also, I'm making my own programming language so there are a few things I've learnt, one is this: You can't just ‘translate’ from one language (Scratch) to another (JS) without considerable effort. You have to break down the scratch program into tokens, create an AST, and then reverse that AST into JS code
- ilovericebubbles
-
100+ posts
How to get Scratch to JavaScript? Support us now!
You could just parse the JSON into Javascript. The nice thing about trying to convert Scratch projects to javascript files is that Scratch projects are stored as JSON files, aka JavaScript Object Notation, the hard part is that scratch's JSON files are a convoluted mess
Also, I'm making my own programming language so there are a few things I've learnt, one is this: You can't just ‘translate’ from one language (Scratch) to another (JS) without considerable effort. You have to break down the scratch program into tokens, create an AST, and then reverse that AST into JS code
If we could use a Lexicon or YACC in JS, it would probably be reasonably easy.
when OSWars [5 v] starts :: events hat
cheer [@-BlueOS-] :: looks
- Discussion Forums
- » Open Source Projects
-
» How to get Scratch to JavaScript? Support us now!