Discuss Scratch

blob8108
Scratcher
1000+ posts

Request: Scratch automation

As part of my work on Kurt, it'd be really useful if I could mod Scratch so that when it opens a file, it automatically runs “clean up” on all the sprites, and then automatically saves the project.

I got as far as adding
	scriptsPane cleanUp.
self saveScratchProjectNoDialog
to the end of Scratch-UI-Panes -> ScratchFrameMorph -> file read/write -> installNewProject:, which seems to clean up scripts for the stage, but it has the unfortunate side-effect of not showing any sprites in the sprites palette. And it'd be really good to do it for sprites as well.

If you know Squeak, could you show me how to do that? Thanks!

tosh · slowly becoming a grown-up adult and very confused about it
Hardmath123
Scratcher
1000+ posts

Request: Scratch automation

You should ideally make this a patch, because I doubt many people will install an entire Scratch mod just to use Kurt (though it would be really cool). LS97 would probably be the best person to ask, though from what I remember, you need to call “changed” or “refresh” on the World.
blob8108
Scratcher
1000+ posts

Request: Scratch automation

Sorry, to clarify: I don't actually want to distribute this, I just want to know how to modify my own copy of Scratch in this way, so that I can extract information from Scratch about the heights of each type of block. I'm not trying to make a Scratch mod that Kurt relies on; I'm just trying to get some information that I can use to build Kurt with.

…LS97?

tosh · slowly becoming a grown-up adult and very confused about it
Hardmath123
Scratcher
1000+ posts

Request: Scratch automation

blob8108 wrote:

Sorry, to clarify: I don't actually want to distribute this, I just want to know how to modify my own copy of Scratch in this way, so that I can extract information from Scratch about the heights of each type of block. I'm not trying to make a Scratch mod that Kurt relies on; I'm just trying to get some information that I can use to build Kurt with.

…LS97?
Ah, that's clever. Why don't you look into the actual code to render blocks?

(Or better: pester the ST to add an “cleanup”:true property to the project JSON? )
blob8108
Scratcher
1000+ posts

Request: Scratch automation

The code is complicated; I'm not very good at reading Squeak. I figure it's easier just to batch measure the heights of a load of different blocks, and use that to reverse-engineer an algorithm for calculating the height of a stack of blocks.

“cleanUpOnLoad”: true is the plan for Scratch 2.0, but I can't very well ask the ST to add new stuff to the 1.4 file format, now, can I?

tosh · slowly becoming a grown-up adult and very confused about it
Hardmath123
Scratcher
1000+ posts

Request: Scratch automation

blob8108 wrote:

The code is complicated; I'm not very good at reading Squeak. I figure it's easier just to batch measure the heights of a load of different blocks, and use that to reverse-engineer an algorithm for calculating the height of a stack of blocks.
How about taking a screenshot of the types of blocks (stack, reporter, boolean, c, if/else, and the margin between a text box input and the block) and measuring it by image processing? I know it's ugly, but it works…
“cleanUpOnLoad”: true is the plan for Scratch 2.0
blob8108
Scratcher
1000+ posts

Request: Scratch automation

Meh, analysing screenshots is more effort than learning Squeak.

tosh · slowly becoming a grown-up adult and very confused about it
Hardmath123
Scratcher
1000+ posts

Request: Scratch automation

blob8108 wrote:

Meh, analysing screenshots is more effort than learning Squeak.
Well, I found the height of a block + puzzle inset by hacking at Squeak, it's 24.

Scratch-Blocks -> BlockMorph -> drawing ->

Last edited by Hardmath123 (June 7, 2013 14:17:22)

blob8108
Scratcher
1000+ posts

Request: Scratch automation

Or you can just use the inspector…

I was going to automate the measuring of various combinations of blocks, such as inserting reporter blocks into other blocks, and use that to figure it out.

But if you can come up with a simple algorithm for the height of a block by reading the source, go for it!

You can assume the shape of each block is known (see kurt.readthedocs.org).

tosh · slowly becoming a grown-up adult and very confused about it
LS97
Scratcher
100+ posts

Request: Scratch automation

Why is LS97 the best person to ask?

Retired Scratcher • Aspiring information systems engineer
Hardmath123
Scratcher
1000+ posts

Request: Scratch automation

LS97 wrote:

Why is LS97 the best person to ask?
You're the smartest Scratch hacker I know, and you've made an awesome mod. And you made the Scramble plugin for me a long time ago.
LS97
Scratcher
100+ posts

Request: Scratch automation

Hardmath123 wrote:

LS97 wrote:

Why is LS97 the best person to ask?
You're the smartest Scratch hacker I know, and you've made an awesome mod. And you made the Scramble plugin for me a long time ago.
Thank you for the compliments

Are you sure about Scramble? I don't even remotely remember

Retired Scratcher • Aspiring information systems engineer
Hardmath123
Scratcher
1000+ posts

Request: Scratch automation

LS97 wrote:

Hardmath123 wrote:

LS97 wrote:

Why is LS97 the best person to ask?
You're the smartest Scratch hacker I know, and you've made an awesome mod. And you made the Scramble plugin for me a long time ago.
Thank you for the compliments

Are you sure about Scramble? I don't even remotely remember
you wrote this patch where you could right-click a script and get back corresponding Squeak for a custom block.
uosav2
New to Scratch
36 posts

Request: Scratch automation

woah cool

hi my name is alexim 9i play minecraft

rules for my profile:
1. no swearing
2. be nice
3. dont be mean
4. be nice
5. like minecraft
6. liker oblox
7. no bad words
8. dont maek fun of me
9. dont make fun of me
10. dont make fun of my pap
11 .dont make fun of my mom
12. follow scratch rules
13. be nice
14. dont spam
15. dont hack
16. dont copy my stuff

Powered by DjangoBB