Discuss Scratch

jvvg
Scratcher
1000+ posts

Convert your scripts to [scratchblocks] on Scratch 2.0

After a bunch of using my whiteboard to outline code, trying to figure out JSON code with no documentation whatsoever, learning obscure APIs using the network logs, figuring out a few new libraries in PHP, and taking exercises in recursion, I was able to make a [scratchblocks] converter for 2.0.

The converter for 1.4 by LS97 was a squeak plugin that you imported and then could right click on a script and have it converted to [scratchblocks]. I wrote my own for Scratch 2.0. It is much easier to install (you don't install anything, it's a webapp), but a bit harder to use.

Basically, here's what you do:
1. Add the scripts you want to convert to your backpack
2. Go to http://futuresight.org/staticprojs/scratchblocks/
3. Enter your username, and click “Load”
4. If you want to view them parsed, click “Parse!”

Last edited by jvvg (Sept. 4, 2013 21:36:22)


jvvg
Administrator and backend engineer on the Scratch Wiki
Executive director of FutureSight Technologies
scimonster
Scratcher
1000+ posts

Convert your scripts to [scratchblocks] on Scratch 2.0

blob8108 ninja'd you by several months.

Retired Community Moderator
BTW, i run Google Chrome 41.0.2272.101 on a Linux system - Ubuntu 14.04. NEW: iPad 4th gen. w/retina.

418 I'm a teapot (original - to be read by bored computer geeks)
THE GAME (you just lost)
; THE SEMICOLON LIVES ON IN OUR SIGS
jvvg
Scratcher
1000+ posts

Convert your scripts to [scratchblocks] on Scratch 2.0

scimonster wrote:

blob8108 ninja'd you by several months.


If anybody wants the source code for a PHP version, it's now on Github.

jvvg
Administrator and backend engineer on the Scratch Wiki
Executive director of FutureSight Technologies
blob8108
Scratcher
1000+ posts

Convert your scripts to [scratchblocks] on Scratch 2.0

scimonster wrote:

blob8108 ninja'd you by several months.
You mean http://blob8108.github.io/scratchblocks2/generator/ .

This must mean I need to get better at advertising…

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

Convert your scripts to [scratchblocks] on Scratch 2.0

You don't appear to have the charset tag. The dropdown arrows aren't rendering properly on your scratchblocks.

EDIT: Whoops, you do have the meta tag. Maybe you're serving http://futuresight.org/staticprojs/scratchblocks/resources/scratchblocks2.css with the wrong encoding?

Last edited by blob8108 (Aug. 30, 2013 13:45:05)


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

Convert your scripts to [scratchblocks] on Scratch 2.0

blob8108 wrote:

You don't appear to have the charset tag. The dropdown arrows aren't rendering properly on your scratchblocks.

EDIT: Whoops, you do have the meta tag. Maybe you're serving http://futuresight.org/staticprojs/scratchblocks/resources/scratchblocks2.css with the wrong encoding?
I fixed it by changing the Content-type header. I'll push it to the website now.

jvvg
Administrator and backend engineer on the Scratch Wiki
Executive director of FutureSight Technologies
blob8108
Scratcher
1000+ posts

Convert your scripts to [scratchblocks] on Scratch 2.0

jvvg wrote:

I fixed it by changing the Content-type header.
Cool! Yeah, it's annoying that. I can't find a way of writing a Unicode symbol in a CSS file using ASCII.

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

Convert your scripts to [scratchblocks] on Scratch 2.0

wait (1) secs

Last edited by BigBlueBlock (Aug. 31, 2013 09:35:28)

jvvg
Scratcher
1000+ posts

Convert your scripts to [scratchblocks] on Scratch 2.0

BigBlueBlock wrote:

wait (1) secs
Sadly, scratchblocks don't work on the forums yet.

jvvg
Administrator and backend engineer on the Scratch Wiki
Executive director of FutureSight Technologies
BigBlueBlock
Scratcher
500+ posts

Convert your scripts to [scratchblocks] on Scratch 2.0

jvvg wrote:

BigBlueBlock wrote:

wait (1) secs
Sadly, scratchblocks don't work on the forums yet.
It's working now!
when gf clicked
say [Hello] for (5) secs
stop [all v]

Last edited by BigBlueBlock (Aug. 31, 2013 09:39:06)

BigBlueBlock
Scratcher
500+ posts

Convert your scripts to [scratchblocks] on Scratch 2.0

>:-) This can read other user's backpacks.
lallaway12
Scratcher
100+ posts

Convert your scripts to [scratchblocks] on Scratch 2.0

define save [list v].list on [variable v].var
set [list return v] to []
set [list item v] to [1]
repeat (length of (list))
set [return v] to []
set [letter v] to [1]
repeat (length of (item (list item) of (list)))
set [symbol v] to [1]
repeat until ((letter (symbol) of (symbols)) = (letter (letter) of (item (list item) of (list))))
change [symbol v] by (1)
end
switch costume to (letter (letter) of (item (list item) of (list)))
if (((costume #) > [26]) and ((symbol) < [53])) then
change [symbol v] by (26)
end
repeat until (((length of (symbol)) = [2]) or ((length of (symbol)) > [2]))
set [symbol v] to (join [0] (symbol))
end
set [return v] to (join (return) (symbol))
change [letter v] by (1)
end
set [list return v] to (join (list return) (join (return) [00]))
change [list item v] by (1)
end
set (variable) to (list return)
define load (number) to [list v].list
set [return v] to []
set [letter v] to [1]
delete (all) of (list)
repeat ((length of (number)) / (2))
set [symbol v] to (join (letter ((letter) + (0)) of (number)) (letter ((letter) + (1)) of (number)))
if (((symbol) = [00]) and (not ((list) = []))) then
change [letter v] by (2)
end

Jvvg working with cloning are you !

See my blog ITS MAD so subscribe comment and enjoy http://lallawayrandom.blogspot.co.uk/ ask me what to put up there
Feed my dragons
jvvg
Scratcher
1000+ posts

Convert your scripts to [scratchblocks] on Scratch 2.0

BigBlueBlock wrote:

>:-) This can read other user's backpacks.
Yeah, I think the API is a bit insecure myself…
However, I checked, and writing to backpacks is secured, so you can't over-write it.

jvvg
Administrator and backend engineer on the Scratch Wiki
Executive director of FutureSight Technologies
blob8108
Scratcher
1000+ posts

Convert your scripts to [scratchblocks] on Scratch 2.0

BigBlueBlock wrote:

>:-) This can read other user's backpacks.
…hence why my generator doesn't have that feature.

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

Convert your scripts to [scratchblocks] on Scratch 2.0

jvvg wrote:

BigBlueBlock wrote:

>:-) This can read other user's backpacks.
Yeah, I think the API is a bit insecure myself…
However, I checked, and writing to backpacks is secured, so you can't over-write it.
Yea, thank me for reporting that to the ST. Before, you could overwrite the backpack, other user's projects, and projects deleted from the trash bin. 0.o

running Chromium 42.0.2311.90 with Flash Player 15.0.0.189 on Arch Linux 3.19.5-1-ck
MathWizzJsScratch && sb.js & Amber (coming soon! maybe)
curiouscrab
Scratcher
500+ posts

Convert your scripts to [scratchblocks] on Scratch 2.0

This version combined all my scripts and made it look wacky. It also read some blocks as obsolete, probably because I used brackets in some of my
add [] to [ v]
blocks.
I also used % and ] which caused errors and the dropdown number inserts has issues.

Last edited by curiouscrab (Sept. 2, 2013 15:33:14)

blob8108
Scratcher
1000+ posts

Convert your scripts to [scratchblocks] on Scratch 2.0

curiouscrab wrote:

combined all my scripts
@jvvg Do you insert blank lines between scripts?

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

Convert your scripts to [scratchblocks] on Scratch 2.0

define decode number (number)
set [temp output v] to []
set [counter v] to [-1]
repeat (number)
change [counter v] by (x)
set [counter2 v] to []
repeat (round (1))
set [x v] to (direction)
end
set [counter2 v] to (x)
set [temp output v] to []
end
I wonder what jvvg is working on right now…
jvvg
Scratcher
1000+ posts

Convert your scripts to [scratchblocks] on Scratch 2.0

blob8108 wrote:

curiouscrab wrote:

combined all my scripts
@jvvg Do you insert blank lines between scripts?
No.

I probably should.

jvvg
Administrator and backend engineer on the Scratch Wiki
Executive director of FutureSight Technologies
blob8108
Scratcher
1000+ posts

Convert your scripts to [scratchblocks] on Scratch 2.0

jvvg wrote:

blob8108 wrote:

curiouscrab wrote:

combined all my scripts
@jvvg Do you insert blank lines between scripts?
I probably should.
Yes. You probably should.

tosh · slowly becoming a grown-up adult and very confused about it

Powered by DjangoBB

Standard | Mobile