Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » Request: Scratch automation
- 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
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!
I got as far as adding
scriptsPane cleanUp.
self saveScratchProjectNoDialog
If you know Squeak, could you show me how to do that? Thanks!
- 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?
…LS97?
- Hardmath123
- Scratcher
1000+ posts
Request: Scratch automation
Ah, that's clever. Why don't you look into the actual code to render blocks? 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?
(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?
“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?
- Hardmath123
- Scratcher
1000+ posts
Request: Scratch automation
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… 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
- Hardmath123
- Scratcher
1000+ posts
Request: Scratch automation
Well, I found the height of a block + puzzle inset by hacking at Squeak, it's 24. Meh, analysing screenshots is more effort than learning Squeak.
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).
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).
- 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
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. Why is LS97 the best person to ask?
- LS97
- Scratcher
100+ posts
Request: Scratch automation
Thank you for the complimentsYou'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. Why is LS97 the best person to ask?
Are you sure about Scramble? I don't even remotely remember
Retired Scratcher • Aspiring information systems engineer
- Hardmath123
- Scratcher
1000+ posts
Request: Scratch automation
you wrote this patch where you could right-click a script and get back corresponding Squeak for a custom block.Thank you for the complimentsYou'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. Why is LS97 the best person to ask?
Are you sure about Scramble? I don't even remotely remember
- 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
- Discussion Forums
- » Advanced Topics
- » Request: Scratch automation