Discuss Scratch

Tronche2Cake
Scratcher
100+ posts

Is there an easy way to convert scratch blocks to plain text and vice versa?

I'm trying to code a Scratch project with ChatGPT (very original, I know) but the AI is only able to write and interact in text.

So, I want to find a way to convert scratch blocks to text, which would allow ChatGPT to interact with it.
I did try to open the project as a .zip file and get into “project.json”. Although it has all the code, it's packed up in an almost unreadable way, and seems generally bothersome to work with without using an IDE of some sort.

If anyone knows of a ressource that allows conversion between scratch blocks and text, I'd be happy to hear about it.
PlNG_
Scratcher
500+ posts

Is there an easy way to convert scratch blocks to plain text and vice versa?

Last edited by PlNG_ (Jan. 23, 2023 17:09:05)

lolecksdeehaha
Scratcher
1000+ posts

Is there an easy way to convert scratch blocks to plain text and vice versa?

There isn't to my knowledge, but it may be a fun script to write. I'll look at the structure of project.json and see what it entails.
ThatCoder77471
Scratcher
1000+ posts

Is there an easy way to convert scratch blocks to plain text and vice versa?

I'm working on something like this

It's not finished yet, but it can convert Scratch to text, just not the other way around

Last edited by ThatCoder77471 (Jan. 23, 2023 18:51:02)

mybearworld
Scratcher
1000+ posts

Is there an easy way to convert scratch blocks to plain text and vice versa?

ChatGPT wouldn't have the knowledge of any Scratch->Text tool that is now created.

Last edited by mybearworld (Jan. 23, 2023 19:01:19)

davidtheplatform
Scratcher
500+ posts

Is there an easy way to convert scratch blocks to plain text and vice versa?

It might know about (or be able to guess) the scratchblocks thing where move (x) steps becomes
movexsteps
lolecksdeehaha
Scratcher
1000+ posts

Is there an easy way to convert scratch blocks to plain text and vice versa?

I'm dissecting the format of the file right now, and next I'm probably going to figure out how to convert blocks to text. I'm planning to also have the “vice versa” in this script right now, too.
Tronche2Cake
Scratcher
100+ posts

Is there an easy way to convert scratch blocks to plain text and vice versa?

mybearworld wrote:

ChatGPT wouldn't have the knowledge of any Scratch->Text tool that is now created.
I already tested ChatGPT to see if it could code in Scratch, and it seems to be doing good.
AXEstudios
Scratcher
100+ posts

Is there an easy way to convert scratch blocks to plain text and vice versa?

This is a cool idea
mybearworld
Scratcher
1000+ posts

Is there an easy way to convert scratch blocks to plain text and vice versa?

Tronche2Cake wrote:

It guesses. when (ball) touches (paddle) is more of a code.org thing.
ajskateboarder
Scratcher
1000+ posts

Is there an easy way to convert scratch blocks to plain text and vice versa?

What's the point of this? This text output can't even be executed, it's just a representation.

And how is this a coding project? You are feeding a prompt to a language model trained on a lot of data.
know0your0true0color
Scratcher
500+ posts

Is there an easy way to convert scratch blocks to plain text and vice versa?

mybearworld wrote:

Tronche2Cake wrote:

It guesses. when (ball) touches (paddle) is more of a code.org thing.
let it know its mistake
from what ive seen 99% of the time it will correct itself
mybearworld
Scratcher
1000+ posts

Is there an easy way to convert scratch blocks to plain text and vice versa?

know0your0true0color wrote:

mybearworld wrote:

Tronche2Cake wrote:

It guesses. when (ball) touches (paddle) is more of a code.org thing.
let it know its mistake
from what ive seen 99% of the time it will correct itself
How would you have it correct that? What it made there is something that looks like scratchblocks syntax but isn't.
whenclickedrepeatuntilcollision=1moveball10stepsifonedge,bounceballwait1secschangecollisionby-1whenballtouchespaddlesetcollisionto1
Tronche2Cake
Scratcher
100+ posts

Is there an easy way to convert scratch blocks to plain text and vice versa?

mybearworld wrote:

know0your0true0color wrote:

mybearworld wrote:

Tronche2Cake wrote:

It guesses. when (ball) touches (paddle) is more of a code.org thing.
let it know its mistake
from what ive seen 99% of the time it will correct itself
How would you have it correct that? What it made there is something that looks like scratchblocks syntax but isn't.
whenclickedrepeatuntilcollision=1moveball10stepsifonedge,bounceballwait1secschangecollisionby-1whenballtouchespaddlesetcollisionto1
I'm guessing it's gonna do better if I give it some actual scratch code in text format
cookieclickerer33
Scratcher
1000+ posts

Is there an easy way to convert scratch blocks to plain text and vice versa?

mybearworld wrote:

ChatGPT wouldn't have the knowledge of any Scratch->Text tool that is now created.
Tell to to make one

It worked for me, yea I literally asked it

Code a scratchblock plugin syntax to scratch project converter in JavaScript

And it did it!
lolecksdeehaha
Scratcher
1000+ posts

Is there an easy way to convert scratch blocks to plain text and vice versa?

cookieclickerer33 wrote:

mybearworld wrote:

ChatGPT wouldn't have the knowledge of any Scratch->Text tool that is now created.
Tell to to make one

It worked for me, yea I literally asked it

Code a scratchblock plugin syntax to scratch project converter in JavaScript

And it did it!
Does it work?
imfh
Scratcher
1000+ posts

Is there an easy way to convert scratch blocks to plain text and vice versa?

RokCoder has a Scratch to text converter, but I don’t think it goes backwards. I’ve also written a Scratch to Python converter that you could probably use GitHub copilot with, or something similar.

Scratch to Text: https://scratch.mit.edu/discuss/topic/509008/
Scratch to Python: https://scratch.mit.edu/discuss/topic/600562/

Last edited by imfh (Feb. 2, 2023 22:07:40)

denhaerynckjonathan
Scratcher
18 posts

Is there an easy way to convert scratch blocks to plain text and vice versa?

applejuiceproduc
Scratcher
1000+ posts

Is there an easy way to convert scratch blocks to plain text and vice versa?

I know there is some scratch-text thing that I've seen (I don't think it's any of the above), it can convert back to scratch (I think).

Maybe if it has some good documentation you could just feed chatgpt the documentation then tell it to write it in that language?
iqsgottalent
Scratcher
1 post

Is there an easy way to convert scratch blocks to plain text and vice versa?

PlNG_ wrote:

Powered by DjangoBB