Discuss Scratch

Pr_Testing
Scratcher
8 posts

Leopard: Convert Scratch projects to JavaScript AUTOMATICALLY!

PullJosh how are u so clever
Remixer56
Scratcher
52 posts

Leopard: Convert Scratch projects to JavaScript AUTOMATICALLY!

One of my projects did not work: https://scratch.mit.edu/projects/363945491/

Scratch on,
Remixer56
-InsanityPlays-
Scratcher
1000+ posts

Leopard: Convert Scratch projects to JavaScript AUTOMATICALLY!

It's called forkphorus not phosphorus now. And btw does it have dark mode?

Welcome to my signature!
I've moved accounts. Anyway, did this post help you? Go follow me on my new account!
Today's Links: Scratch 4.0 Leaked Information, Astronomical - The Third, The Forum Community
follow me on scratch or i am sad, subscribe to my YouTube channel or bad luck for the rest of your life
My Final Shoutout: hekcer because in computer science class, he is the hekcerman
-InsanityPlays- Fan Studio! (closed) | Astronomical - The Third | Best of -InsanityPlays- 2020
my channel, my website, ctrl+shift+down for more STUFF







2020's Advent Collection:

more STUFF
BearSlothCoding
Scratcher
1000+ posts

Leopard: Convert Scratch projects to JavaScript AUTOMATICALLY!

-InsanityPlays- wrote:

It's called forkphorus not phosphorus now. And btw does it have dark mode?
No, those are two separate things, Forkphorus is based off of Phosphorus. And Forkphorus has it but Phosphrous doesn't. Also, this is for Leopard, not Forkphorus or Phosphorus.
Yes, I made sure I said both Forkphorus and Phosphorus in each sentence.
PullJosh
Scratcher
1000+ posts

Leopard: Convert Scratch projects to JavaScript AUTOMATICALLY!

Pr_Testing
Scratcher
8 posts

Leopard: Convert Scratch projects to JavaScript AUTOMATICALLY!

PullJosh wrote:

Pr_Testing wrote:

PullJosh how are u so clever
It isn't just me!
ur definitely one of em! isn’t it u who thought of the leopard idea? (apart from all ur tutorials which are useful and in depth - u are a clever lad) of course there are loads of ppl out there
theXliner
Scratcher
83 posts

Leopard: Convert Scratch projects to JavaScript AUTOMATICALLY!

Hmm I have a VERY MINOR suggestion:
Could you make a Python3 API? I mostly code python, and is currently trying to understand Swift & C++. JavaScript/Other languages are on the bottom of my list. So a Python3 API for sh-edit would be nice.

apple502j
Scratcher
1000+ posts

Leopard: Convert Scratch projects to JavaScript AUTOMATICALLY!

theXliner wrote:

Hmm I have a VERY MINOR suggestion:
Could you make a Python3 API? I mostly code python, and is currently trying to understand Swift & C++. JavaScript/Other languages are on the bottom of my list. So a Python3 API for sh-edit would be nice.
Maybe I can make it - but let me fix some bugs in parse-sb3-blocks first

署名は、ディスカッションフォーラムの機能である。署名は、その人のすべての投稿の下部に追加される。署名は、BBCodeで記述できる。 署名を追加/変更/削除したい場合は、ディスカッションフォーラムのホームの一番下に行き、「Change your signature」を押す。署名の大きさは150pxまでである。これには、改行、画像を含む。- Japanese Scratch-Wiki 「署名
DecaTen
Scratcher
4 posts

Leopard: Convert Scratch projects to JavaScript AUTOMATICALLY!

I've noticed that the trigonometric functions do not take Scratch's 90 degree offset into account.
greedjesse
Scratcher
100+ posts

Leopard: Convert Scratch projects to JavaScript AUTOMATICALLY!


✅AD
❎F4F
Pr_Testing
Scratcher
8 posts

Leopard: Convert Scratch projects to JavaScript AUTOMATICALLY!

theXliner
Scratcher
83 posts

Leopard: Convert Scratch projects to JavaScript AUTOMATICALLY!

apple502j wrote:

theXliner wrote:

Hmm I have a VERY MINOR suggestion:
Could you make a Python3 API? I mostly code python, and is currently trying to understand Swift & C++. JavaScript/Other languages are on the bottom of my list. So a Python3 API for sh-edit would be nice.
Maybe I can make it - but let me fix some bugs in parse-sb3-blocks first
I'm making one right now! It's a private GitHub repo for now. If you have a GitHub account, tell me your username! Then we could work on this together. The thing is, I plan to make it pure python. It is basically scratch-to-pygame.


EDIT: I also use Atom, so we can use the Teletype ability. I'm also working on parsing the JSON to tokens, so any language can benefit. Psst, I only know python thoroughly.

Last edited by theXliner (July 8, 2020 16:42:15)


Pr_Testing
Scratcher
8 posts

Leopard: Convert Scratch projects to JavaScript AUTOMATICALLY!

theXliner wrote:

apple502j wrote:

theXliner wrote:

Hmm I have a VERY MINOR suggestion:
Could you make a Python3 API? I mostly code python, and is currently trying to understand Swift & C++. JavaScript/Other languages are on the bottom of my list. So a Python3 API for sh-edit would be nice.
Maybe I can make it - but let me fix some bugs in parse-sb3-blocks first
I'm making one right now! It's a private GitHub repo for now. If you have a GitHub account, tell me your username! Then we could work on this together. The thing is, I plan to make it pure python. It is basically scratch-to-pygame.
call it purrr
PullJosh
Scratcher
1000+ posts

Leopard: Convert Scratch projects to JavaScript AUTOMATICALLY!

DecaTen wrote:

I've noticed that the trigonometric functions do not take Scratch's 90 degree offset into account.
Good catch! The issue is actually that the trig functions do use Scratch's directional system when they should use regular degrees (where 0 = right).

I've updated Leopard so that this is no longer an issue.
Bears8
Scratcher
9 posts

Leopard: Convert Scratch projects to JavaScript AUTOMATICALLY!

This is great!. I've noticed that some of my projects don't work with leopard. When the code is converted nothing happens and it just remains a black screen. Then when I click “Edit as javascript” it has me download “codesandbox.json”
BamBozzle
Scratcher
3 posts

Leopard: Convert Scratch projects to JavaScript AUTOMATICALLY!

Very impressive my guy! Well done! I just want to highlight that this monstrosity doesn't work on it (https://scratch.mit.edu/projects/395414289/) although I don't recommend filtering through all the 4000ish blocks but if youre interested
theXliner
Scratcher
83 posts

Leopard: Convert Scratch projects to JavaScript AUTOMATICALLY!

How does sb-edit work? Which JSON does it get input from? The unzipped sb3 or the project.scratch link? Because I want to fork that JavaScript into return a list of tokens which then anyone can parse.

Sheep_maker
Scratcher
1000+ posts

Leopard: Convert Scratch projects to JavaScript AUTOMATICALLY!

BamBozzle wrote:

Very impressive my guy! Well done! I just want to highlight that this monstrosity doesn't work on it (https://scratch.mit.edu/projects/395414289/) although I don't recommend filtering through all the 4000ish blocks but if youre interested
It seems that in Sprite1's Map custom block, it's trying to get item rm of map1, but since rm starts at zero and hasn't yet been changed, it tries to get the length of a nonexistent string item in the list, which throws an error in JS
  *map() {
    this.stage.vars.rm = 0;
    for (let i = 0; i < this.stage.vars.map1.length + 1; i++) {
      this.stage.vars.rl = 0;
      for (
        let i = 0;
        i < this.stage.vars.map1[this.stage.vars.rm - 1].length + 1;
        //                                               ^^^^^^
        // TypeError: Cannot read property 'length' of undefined
        i++
      ) {

I wonder if Leopard will be hip and modern and use the optional chaining operator ?. to avoid this

theXliner wrote:

How does sb-edit work? Which JSON does it get input from? The unzipped sb3 or the project.scratch link? Because I want to fork that JavaScript into return a list of tokens which then anyone can parse.
You can use Project.fromSb3 and pass in a buffer of the zipped .sb3 file or Project.fromSb3JSON with the project.json from projects.scratch.mit.edu

Last edited by Sheep_maker (July 8, 2020 19:42:30)


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

Leopard: Convert Scratch projects to JavaScript AUTOMATICALLY!

Bears8 wrote:

This is great!. I've noticed that some of my projects don't work with leopard. When the code is converted nothing happens and it just remains a black screen. Then when I click “Edit as javascript” it has me download “codesandbox.json”
That's interesting. Could you post some broken project links?
PullJosh
Scratcher
1000+ posts

Leopard: Convert Scratch projects to JavaScript AUTOMATICALLY!

I updated the first post with this new section called “Upcoming Improvements”.

PullJosh wrote:

Upcoming Improvements
Based on the feedback I'm seeing on the forums and in comments, these are the top-priority issues to solve (most important first):
  1. Sprite layering doesn't work! go to front/back & go forward/backward blocks need to be implemented.
  2. Projects run too fast! Leopard projects currently run at 60fps, but it should also be possible to slow them down to 30fps.
  3. If touching edge and if on edge, bounce blocks don't work.
  4. Lots of little bugs that all add up to cause issues
Have I sorted these priorities correctly? I'd love to hear any comments you might have.

Powered by DjangoBB