Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to hack your own magic custom blocks
- Tropic
-
1000+ posts
How to hack your own magic custom blocks
Rename it from projectnamehere.sb2 to projectnamehere.zip. If the extensions (.zip, .sb2, etc.) are hidden, check the control panel and try to change the folder settings How do you save it to a zip?

- dracoma20361
-
1 post
How to hack your own magic custom blocks
,mnhbgfgyu789098uihjbv vgtyu67yuhjbn bnj
- Tropic
-
1000+ posts
How to hack your own magic custom blocks
,mnhbgfgyu789098uihjbv vgtyu67yuhjbn bnj?
- awesomeness01
-
97 posts
How to hack your own magic custom blocks
Working, but the block is a boolean when it should be a reporter.Cool, but it does not appear to be workingnow it ishttp://scratch.mit.edu/projects/33732648/#editor/The project's not shared. look at this project for cool scripts
- awesomeness01
-
97 posts
How to hack your own magic custom blocks
Or when it asks you to input the download name as you are saving it, type in your_project_name_here.zip .Rename it from projectnamehere.sb2 to projectnamehere.zip. If the extensions (.zip, .sb2, etc.) are hidden, check the control panel and try to change the folder settings How do you save it to a zip?
- awesomeness01
-
97 posts
How to hack your own magic custom blocks
Just make an experimental extension. I once made one that did exactly that, but since it contains an experimental extension, it can't be shared.I agree with @learnegyI agree. Also, could you make a “open url” block? I bet you could, which would be really cool.A brilliant idea to finding the highest priority features and blocks. I support this.Perhaps, Scratch could just detect and label projects that use non-standard blocks, inputs, etc. Over time, you could track the use of various hacks and use the data as input when considering new features to implement in future versions. I wouldn't mind at all if this was being done only with downloaded, local projects. But these are public, shared ones, that people are likely to “see inside”. Any thoughts on the issue?
But I don't think a “open url” block would be that good since it may link to inappropriate websites. But maybe you can use the list of websites in the forums and make it only possible to link to websites that has been checked that they're secure?
- dhdguysg
-
100+ posts
How to hack your own magic custom blocks
Lel
when green flag clicked
Add [Lel] to [List 1 v] :: custom
// List 1 v is actully (ListChosen)
define Add (s :: custom-arg) to (ThisList :: custom-arg)
Add (s :: custom-arg) to (listChosen :: list)
- LilAdamBrooks
-
99 posts
How to hack your own magic custom blocks
I really want to tell you something. It does not work.
- Ziyad29
-
64 posts
How to hack your own magic custom blocks
Hacking your own custom blocksI'm sorry, but I do not get step #1. Can anyone help me please???!!! Thanks
A tutorial
Basically, in this tutorial I'm going to demonstrate how to mess with blocks offline so that you can manually insert reporters in forbidden spaces, and even create custom blocks.
Step 1: Setup
Open up a new Scratch 2.0 project and make a new custom block. For this tutorial, I'm going to make a block that automates a boring thing: adding a value many times to a list. You will be able to, with one block, add an arbitrary value to a list, an arbitrary number of times.
Make a new Scratch project, and add a new custom block:Pretty straightforward. Remember to make a list to get the list blocks!define [Fill [list] with [a],(n) times]
repeat (n)
|add [a] to [list v]
Step 2: Downloading a project
Now select File>>Export to local drive to save it to your local disk. In the popup, rename it to “Hack.zip”. Note the “.zip”, not “.sb2”. Pick any place to save it. Now, unarchive the zip.
On Mac or Windows, just double-click the zip file. On Mac and Linux, you can also use the “unzip” command-line utility.You should get a whole bunch of goodies:$ cd ~/path/to/zip's/folder $ unzip Hack.zipThe second two items are the defaults loaded into a project.
- project.json!
- 0.png: this is the image which contains pen trails/stamps
- 1,2,3.svg: costumes and backgrounds
- 0.wav: sounds
(At this point, you can safely delete the zip file.)
Step 3: Modifying the code!
Now, open up project.json in your favorite text editor/code editor. Here's what you should see:{ "objName": "Stage", "lists": [{ "listName": "dummy", "contents": [], "isPersistent": false, "target": "Stage", "x": 5, "y": 5, "width": 102, "height": 202, "visible": true }], "sounds": [{ "soundName": "pop", "soundID": 0, "md5": "83a9787d4cb6f3b7632b4ddfebf74367.wav", "sampleCount": 258, "rate": 11025, "format": "" }], "costumes": [{ "costumeName": "backdrop1", "baseLayerID": 3, "baseLayerMD5": "790f7842ea100f71b34e5b9a5bfbcaa1.svg", "rotationCenterX": 240, "rotationCenterY": 180 }], "currentCostumeIndex": 0, "penLayerMD5": "279467d0d49e152706ed66539b577c00.png", "tempoBPM": 60, "children": [{ "objName": "Scratch Cat", "scripts": [[53, 47.8, [["procDef", "Fill %s with %s , %n times", ["list", "a", "n"], ["", "", 1], true], ["doRepeat", ["getParam", "n"], [["append:toList:", ["getParam", "a"], "dummy"]]]]]], "sounds": [{ "soundName": "pop", "soundID": 0, "md5": "83a9787d4cb6f3b7632b4ddfebf74367.wav", "sampleCount": 258, "rate": 11025, "format": "" }], "costumes": [{ "costumeName": "costume1", "baseLayerID": 1, "baseLayerMD5": "f9a1c175dbe2e5dee472858dd30d16bb.svg", "rotationCenterX": 47, "rotationCenterY": 55 }, { "costumeName": "costume2", "baseLayerID": 2, "baseLayerMD5": "6e8bd9ae68fdb02b7e1e3df656a75635.svg", "rotationCenterX": 47, "rotationCenterY": 55 }], "currentCostumeIndex": 0, "scratchX": 0, "scratchY": 0, "scale": 1, "direction": 90, "rotationStyle": "normal", "isDraggable": false, "indexInLibrary": 1, "visible": true, "spriteInfo": { } }], "info": { "scriptCount": 1, "spriteCount": 1 } }
Don't panic! I'll walk you through it.
The format you see with all the colons and brackets is called JSON (JavaScript Object Notation). It's a simple notation to describe data structures. Read more here, but for now I'll explain the basics as we go.
If you have a search utility in your text editor (try ctrl-F), look for “Scratch Cat” (the name of the sprite in which we added the custom block).
These lines are what we will be messing with. “objName” means the sprite's name, and “scripts” is a list of scripts.
Replace that bit, up to but not including the line “sounds” with:"objName": "Scratch Cat", "scripts": [[28, 101.9, [["procDef", "Fill %m.list with %s , %n times", ["list", "a", "n"], ["", "something", 10], true], ["doRepeat", ["getParam", "n"], [["append:toList:", ["getParam", "a"], ["getParam", "list"]]] ]]]],
All I did was replace a text input with a list drop down. A complete list of %-things can be found here, courtesy nXIII. I also changed the input to the append function. Finally, I changed the default values in the first line for a professional look.
Step 4: Reuploading
Now save the json file and quit. You need to re-zip these files.
On Windows, right-click the folder in which you saved the original zip, and choose “Send to”>>“Compressed (Zipped) folder”. On Mac, rihgt-click the folder and select “Compress…”. On Mac and Linux you can also use the “zip” utility basically the same way we did above. Rename the new file to “Hack.sb2”.
Open up the Scratch project and select File>>Import from local drive. If it gives you any warnings, select “Ok”. Enjoy!

- Tropic
-
1000+ posts
How to hack your own magic custom blocks
I changed the quote a little. Maybe that will help?Hacking your own custom blocksI'm sorry, but I do not get step #1. Can anyone help me please???!!! Thanks
A tutorial
Basically, in this tutorial I'm going to demonstrate how to mess with blocks offline so that you can manually insert reporters in forbidden spaces, and even create custom blocks.
Step 1: Setup
Open up a new Scratch 2.0 project and make a new custom block. For this tutorial, I'm going to make a block that automates a boring thing: adding a value many times to a list. You will be able to, with one block, add an arbitrary value to a list, an arbitrary number of times.
Make a new Scratch project, and add a new custom block:define Fill [list] with [a],(n) timesPretty straightforward. Remember to make a list to get the list blocks!
repeat (n)
add [a] to [list v]
Step 2: Downloading a project
Now select File>>Export to local drive to save it to your local disk. In the popup, rename it to "Hack.zip". Note the ".zip“, not ”.sb2". Pick any place to save it. Now, unarchive the zip.
On Mac or Windows, just double-click the zip file. On Mac and Linux, you can also use the “unzip” command-line utility.You should get a whole bunch of goodies:$ cd ~/path/to/zip's/folder $ unzip Hack.zipThe second two items are the defaults loaded into a project.
- project.json!
- 0.png: this is the image which contains pen trails/stamps
- 1,2,3.svg: costumes and backgrounds
- 0.wav: sounds
(At this point, you can safely delete the zip file.)
Step 3: Modifying the code!
Now, open up project.json in your favorite text editor/code editor. Here's what you should see:{ "objName": "Stage", "lists": [{ "listName": "dummy", "contents": [], "isPersistent": false, "target": "Stage", "x": 5, "y": 5, "width": 102, "height": 202, "visible": true }], "sounds": [{ "soundName": "pop", "soundID": 0, "md5": "83a9787d4cb6f3b7632b4ddfebf74367.wav", "sampleCount": 258, "rate": 11025, "format": "" }], "costumes": [{ "costumeName": "backdrop1", "baseLayerID": 3, "baseLayerMD5": "790f7842ea100f71b34e5b9a5bfbcaa1.svg", "rotationCenterX": 240, "rotationCenterY": 180 }], "currentCostumeIndex": 0, "penLayerMD5": "279467d0d49e152706ed66539b577c00.png", "tempoBPM": 60, "children": [{ "objName": "Scratch Cat", "scripts": [[53, 47.8, [["procDef", "Fill %s with %s , %n times", ["list", "a", "n"], ["", "", 1], true], ["doRepeat", ["getParam", "n"], [["append:toList:", ["getParam", "a"], "dummy"]]]]]], "sounds": [{ "soundName": "pop", "soundID": 0, "md5": "83a9787d4cb6f3b7632b4ddfebf74367.wav", "sampleCount": 258, "rate": 11025, "format": "" }], "costumes": [{ "costumeName": "costume1", "baseLayerID": 1, "baseLayerMD5": "f9a1c175dbe2e5dee472858dd30d16bb.svg", "rotationCenterX": 47, "rotationCenterY": 55 }, { "costumeName": "costume2", "baseLayerID": 2, "baseLayerMD5": "6e8bd9ae68fdb02b7e1e3df656a75635.svg", "rotationCenterX": 47, "rotationCenterY": 55 }], "currentCostumeIndex": 0, "scratchX": 0, "scratchY": 0, "scale": 1, "direction": 90, "rotationStyle": "normal", "isDraggable": false, "indexInLibrary": 1, "visible": true, "spriteInfo": { } }], "info": { "scriptCount": 1, "spriteCount": 1 } }
Don't panic! I'll walk you through it.
The format you see with all the colons and brackets is called JSON (JavaScript Object Notation). It's a simple notation to describe data structures. Read more here, but for now I'll explain the basics as we go.
If you have a search utility in your text editor (try ctrl-F), look for "Scratch Cat“ (the name of the sprite in which we added the custom block).
These lines are what we will be messing with. ”objName“ means the sprite's name, and ”scripts" is a list of scripts.
Replace that bit, up to but not including the line "sounds" with:"objName": "Scratch Cat", "scripts": [[28, 101.9, [["procDef", "Fill %m.list with %s , %n times", ["list", "a", "n"], ["", "something", 10], true], ["doRepeat", ["getParam", "n"], [["append:toList:", ["getParam", "a"], ["getParam", "list"]]] ]]]],
All I did was replace a text input with a list drop down. A complete list of %-things can be found here, courtesy nXIII. I also changed the input to the append function. Finally, I changed the default values in the first line for a professional look.
Step 4: Reuploading
Now save the json file and quit. You need to re-zip these files.
On Windows, right-click the folder in which you saved the original zip, and choose "Send to“>>”Compressed (Zipped) folder". On Mac, right-click the folder and select "Compress…". On Mac and Linux you can also use the "zip" utility basically the same way we did above. Rename the new file to "Hack.sb2".
Open up the Scratch project and select File>>Import from local drive. If it gives you any warnings, select "Ok". Enjoy!

Last edited by Tropic (Nov. 22, 2014 19:46:31)
- yugi1024
-
30 posts
How to hack your own magic custom blocks
Hacking your own custom blocksI'm blank
A tutorial
Basically, in this tutorial I'm going to demonstrate how to mess with blocks offline so that you can manually insert reporters in forbidden spaces, and even create custom blocks.
Step 1: Setup
Open up a new Scratch 2.0 project and make a new custom block. For this tutorial, I'm going to make a block that automates a boring thing: adding a value many times to a list. You will be able to, with one block, add an arbitrary value to a list, an arbitrary number of times.
Make a new Scratch project, and add a new custom block:Pretty straightforward. Remember to make a list to get the list blocks!define [Fill [list] with [a],(n) times]
repeat (n)
|add [a] to [list v]
Step 2: Downloading a project
Now select File>>Export to local drive to save it to your local disk. In the popup, rename it to “Hack.zip”. Note the “.zip”, not “.sb2”. Pick any place to save it. Now, unarchive the zip.
On Mac or Windows, just double-click the zip file. On Mac and Linux, you can also use the “unzip” command-line utility.You should get a whole bunch of goodies:$ cd ~/path/to/zip's/folder $ unzip Hack.zipThe second two items are the defaults loaded into a project.
- project.json!
- 0.png: this is the image which contains pen trails/stamps
- 1,2,3.svg: costumes and backgrounds
- 0.wav: sounds
(At this point, you can safely delete the zip file.)
Step 3: Modifying the code!
Now, open up project.json in your favorite text editor/code editor. Here's what you should see:{ "objName": "Stage", "lists": [{ "listName": "dummy", "contents": [], "isPersistent": false, "target": "Stage", "x": 5, "y": 5, "width": 102, "height": 202, "visible": true }], "sounds": [{ "soundName": "pop", "soundID": 0, "md5": "83a9787d4cb6f3b7632b4ddfebf74367.wav", "sampleCount": 258, "rate": 11025, "format": "" }], "costumes": [{ "costumeName": "backdrop1", "baseLayerID": 3, "baseLayerMD5": "790f7842ea100f71b34e5b9a5bfbcaa1.svg", "rotationCenterX": 240, "rotationCenterY": 180 }], "currentCostumeIndex": 0, "penLayerMD5": "279467d0d49e152706ed66539b577c00.png", "tempoBPM": 60, "children": [{ "objName": "Scratch Cat", "scripts": [[53, 47.8, [["procDef", "Fill %s with %s , %n times", ["list", "a", "n"], ["", "", 1], true], ["doRepeat", ["getParam", "n"], [["append:toList:", ["getParam", "a"], "dummy"]]]]]], "sounds": [{ "soundName": "pop", "soundID": 0, "md5": "83a9787d4cb6f3b7632b4ddfebf74367.wav", "sampleCount": 258, "rate": 11025, "format": "" }], "costumes": [{ "costumeName": "costume1", "baseLayerID": 1, "baseLayerMD5": "f9a1c175dbe2e5dee472858dd30d16bb.svg", "rotationCenterX": 47, "rotationCenterY": 55 }, { "costumeName": "costume2", "baseLayerID": 2, "baseLayerMD5": "6e8bd9ae68fdb02b7e1e3df656a75635.svg", "rotationCenterX": 47, "rotationCenterY": 55 }], "currentCostumeIndex": 0, "scratchX": 0, "scratchY": 0, "scale": 1, "direction": 90, "rotationStyle": "normal", "isDraggable": false, "indexInLibrary": 1, "visible": true, "spriteInfo": { } }], "info": { "scriptCount": 1, "spriteCount": 1 } }
Don't panic! I'll walk you through it.
The format you see with all the colons and brackets is called JSON (JavaScript Object Notation). It's a simple notation to describe data structures. Read more here, but for now I'll explain the basics as we go.
If you have a search utility in your text editor (try ctrl-F), look for “Scratch Cat” (the name of the sprite in which we added the custom block).
These lines are what we will be messing with. “objName” means the sprite's name, and “scripts” is a list of scripts.
Replace that bit, up to but not including the line “sounds” with:"objName": "Scratch Cat", "scripts": [[28, 101.9, [["procDef", "Fill %m.list with %s , %n times", ["list", "a", "n"], ["", "something", 10], true], ["doRepeat", ["getParam", "n"], [["append:toList:", ["getParam", "a"], ["getParam", "list"]]] ]]]],
All I did was replace a text input with a list drop down. A complete list of %-things can be found here, courtesy nXIII. I also changed the input to the append function. Finally, I changed the default values in the first line for a professional look.
Step 4: Reuploading
Now save the json file and quit. You need to re-zip these files.
On Windows, right-click the folder in which you saved the original zip, and choose “Send to”>>“Compressed (Zipped) folder”. On Mac, rihgt-click the folder and select “Compress…”. On Mac and Linux you can also use the “zip” utility basically the same way we did above. Rename the new file to “Hack.sb2”.
Open up the Scratch project and select File>>Import from local drive. If it gives you any warnings, select “Ok”. Enjoy!
- yugi1024
-
30 posts
How to hack your own magic custom blocks
No offense, but it doesn't help at all.I changed the quote a little. Maybe that will help?Hacking your own custom blocksI'm sorry, but I do not get step #1. Can anyone help me please???!!! Thanks
A tutorial
Basically, in this tutorial I'm going to demonstrate how to mess with blocks offline so that you can manually insert reporters in forbidden spaces, and even create custom blocks.
Step 1: Setup
Open up a new Scratch 2.0 project and make a new custom block. For this tutorial, I'm going to make a block that automates a boring thing: adding a value many times to a list. You will be able to, with one block, add an arbitrary value to a list, an arbitrary number of times.
Make a new Scratch project, and add a new custom block:define Fill [list] with [a],(n) timesPretty straightforward. Remember to make a list to get the list blocks!
repeat (n)
add [a] to [list v]
Step 2: Downloading a project
Now select File>>Export to local drive to save it to your local disk. In the popup, rename it to "Hack.zip". Note the ".zip“, not ”.sb2". Pick any place to save it. Now, unarchive the zip.
On Mac or Windows, just double-click the zip file. On Mac and Linux, you can also use the “unzip” command-line utility.You should get a whole bunch of goodies:$ cd ~/path/to/zip's/folder $ unzip Hack.zipThe second two items are the defaults loaded into a project.
- project.json!
- 0.png: this is the image which contains pen trails/stamps
- 1,2,3.svg: costumes and backgrounds
- 0.wav: sounds
(At this point, you can safely delete the zip file.)
Step 3: Modifying the code!
Now, open up project.json in your favorite text editor/code editor. Here's what you should see:{ "objName": "Stage", "lists": [{ "listName": "dummy", "contents": [], "isPersistent": false, "target": "Stage", "x": 5, "y": 5, "width": 102, "height": 202, "visible": true }], "sounds": [{ "soundName": "pop", "soundID": 0, "md5": "83a9787d4cb6f3b7632b4ddfebf74367.wav", "sampleCount": 258, "rate": 11025, "format": "" }], "costumes": [{ "costumeName": "backdrop1", "baseLayerID": 3, "baseLayerMD5": "790f7842ea100f71b34e5b9a5bfbcaa1.svg", "rotationCenterX": 240, "rotationCenterY": 180 }], "currentCostumeIndex": 0, "penLayerMD5": "279467d0d49e152706ed66539b577c00.png", "tempoBPM": 60, "children": [{ "objName": "Scratch Cat", "scripts": [[53, 47.8, [["procDef", "Fill %s with %s , %n times", ["list", "a", "n"], ["", "", 1], true], ["doRepeat", ["getParam", "n"], [["append:toList:", ["getParam", "a"], "dummy"]]]]]], "sounds": [{ "soundName": "pop", "soundID": 0, "md5": "83a9787d4cb6f3b7632b4ddfebf74367.wav", "sampleCount": 258, "rate": 11025, "format": "" }], "costumes": [{ "costumeName": "costume1", "baseLayerID": 1, "baseLayerMD5": "f9a1c175dbe2e5dee472858dd30d16bb.svg", "rotationCenterX": 47, "rotationCenterY": 55 }, { "costumeName": "costume2", "baseLayerID": 2, "baseLayerMD5": "6e8bd9ae68fdb02b7e1e3df656a75635.svg", "rotationCenterX": 47, "rotationCenterY": 55 }], "currentCostumeIndex": 0, "scratchX": 0, "scratchY": 0, "scale": 1, "direction": 90, "rotationStyle": "normal", "isDraggable": false, "indexInLibrary": 1, "visible": true, "spriteInfo": { } }], "info": { "scriptCount": 1, "spriteCount": 1 } }
Don't panic! I'll walk you through it.
The format you see with all the colons and brackets is called JSON (JavaScript Object Notation). It's a simple notation to describe data structures. Read more here, but for now I'll explain the basics as we go.
If you have a search utility in your text editor (try ctrl-F), look for "Scratch Cat“ (the name of the sprite in which we added the custom block).
These lines are what we will be messing with. ”objName“ means the sprite's name, and ”scripts" is a list of scripts.
Replace that bit, up to but not including the line "sounds" with:"objName": "Scratch Cat", "scripts": [[28, 101.9, [["procDef", "Fill %m.list with %s , %n times", ["list", "a", "n"], ["", "something", 10], true], ["doRepeat", ["getParam", "n"], [["append:toList:", ["getParam", "a"], ["getParam", "list"]]] ]]]],
All I did was replace a text input with a list drop down. A complete list of %-things can be found here, courtesy nXIII. I also changed the input to the append function. Finally, I changed the default values in the first line for a professional look.
Step 4: Reuploading
Now save the json file and quit. You need to re-zip these files.
On Windows, right-click the folder in which you saved the original zip, and choose "Send to“>>”Compressed (Zipped) folder". On Mac, right-click the folder and select "Compress…". On Mac and Linux you can also use the "zip" utility basically the same way we did above. Rename the new file to "Hack.sb2".
Open up the Scratch project and select File>>Import from local drive. If it gives you any warnings, select "Ok". Enjoy!
- Tropic
-
1000+ posts
How to hack your own magic custom blocks
Don't you know what to do? I made it in colour here:Hacking your own custom blocksI'm blank
A tutorial
Basically, in this tutorial I'm going to demonstrate how to mess with blocks offline…
…Open up the Scratch project and select File>>Import from local drive. If it gives you any warnings, select “Ok”. Enjoy!
Hacking your own custom blocks
A tutorial
Basically, in this tutorial I'm going to demonstrate how to mess with blocks offline so that you can manually insert reporters in forbidden spaces, and even create custom blocks.
Step 1: Setup
Open up a new Scratch 2.0 project and make a new custom block. For this tutorial, I'm going to make a block that automates a boring thing: adding a value many times to a list. You will be able to, with one block, add an arbitrary value to a list, an arbitrary number of times.
Make a new Scratch project, and add a new custom block:define Fill [list] with [a],(n) timesPretty straightforward. Remember to make a list to get the list blocks!
repeat (n)
add [a] to [list v]
Step 2: Downloading a project
Now select File>>Export to local drive to save it to your local disk. In the popup, rename it to "Hack.zip". Note the ".zip“, not ”.sb2". Pick any place to save it. Now, unarchive the zip.
On Mac or Windows, just double-click the zip file. On Mac and Linux, you can also use the “unzip” command-line utility.You should get a whole bunch of goodies:$ cd ~/path/to/zip's/folder $ unzip Hack.zipThe second two items are the defaults loaded into a project.
- project.json!
- 0.png: this is the image which contains pen trails/stamps
- 1,2,3.svg: costumes and backgrounds
- 0.wav: sounds
(At this point, you can safely delete the zip file.)
Step 3: Modifying the code!
Now, open up project.json in your favorite text editor/code editor. Here's what you should see:{ "objName": "Stage", "lists": [{ "listName": "dummy", "contents": [], "isPersistent": false, "target": "Stage", "x": 5, "y": 5, "width": 102, "height": 202, "visible": true }], "sounds": [{ "soundName": "pop", "soundID": 0, "md5": "83a9787d4cb6f3b7632b4ddfebf74367.wav", "sampleCount": 258, "rate": 11025, "format": "" }], "costumes": [{ "costumeName": "backdrop1", "baseLayerID": 3, "baseLayerMD5": "790f7842ea100f71b34e5b9a5bfbcaa1.svg", "rotationCenterX": 240, "rotationCenterY": 180 }], "currentCostumeIndex": 0, "penLayerMD5": "279467d0d49e152706ed66539b577c00.png", "tempoBPM": 60, "children": [{ "objName": "Scratch Cat", "scripts": [[53, 47.8, [["procDef", "Fill %s with %s , %n times", ["list", "a", "n"], ["", "", 1], true], ["doRepeat", ["getParam", "n"], [["append:toList:", ["getParam", "a"], "dummy"]]]]]], "sounds": [{ "soundName": "pop", "soundID": 0, "md5": "83a9787d4cb6f3b7632b4ddfebf74367.wav", "sampleCount": 258, "rate": 11025, "format": "" }], "costumes": [{ "costumeName": "costume1", "baseLayerID": 1, "baseLayerMD5": "f9a1c175dbe2e5dee472858dd30d16bb.svg", "rotationCenterX": 47, "rotationCenterY": 55 }, { "costumeName": "costume2", "baseLayerID": 2, "baseLayerMD5": "6e8bd9ae68fdb02b7e1e3df656a75635.svg", "rotationCenterX": 47, "rotationCenterY": 55 }], "currentCostumeIndex": 0, "scratchX": 0, "scratchY": 0, "scale": 1, "direction": 90, "rotationStyle": "normal", "isDraggable": false, "indexInLibrary": 1, "visible": true, "spriteInfo": { } }], "info": { "scriptCount": 1, "spriteCount": 1 } }
Don't panic! I'll walk you through it.
The format you see with all the colons and brackets is called JSON (JavaScript Object Notation). It's a simple notation to describe data structures. Read more here, but for now I'll explain the basics as we go.
If you have a search utility in your text editor (try ctrl-F), look for "Scratch Cat“ (the name of the sprite in which we added the custom block).
These lines are what we will be messing with. ”objName“ means the sprite's name, and ”scripts" is a list of scripts.
Replace that bit, up to but not including the line "sounds" with:"objName": "Scratch Cat", "scripts": [[28, 101.9, [["procDef", "Fill %m.list with %s , %n times", ["list", "a", "n"], ["", "something", 10], true], ["doRepeat", ["getParam", "n"], [["append:toList:", ["getParam", "a"], ["getParam", "list"]]] ]]]],
All I did was replace a text input with a list drop down. A complete list of %-things can be found here, courtesy nXIII. I also changed the input to the append function. Finally, I changed the default values in the first line for a professional look.
Step 4: Reuploading
Now save the json file and quit. You need to re-zip these files.
On Windows, right-click the folder in which you saved the original zip, and choose "Send to“>>”Compressed (Zipped) folder". On Mac, right-click the folder and select "Compress…". On Mac and Linux you can also use the "zip" utility basically the same way we did above. Rename the new file to "Hack.sb2".
Open up the Scratch project and select File>>Import from local drive. If it gives you any warnings, select "Ok". Enjoy!
- yugi1024
-
30 posts
How to hack your own magic custom blocks
I mean I didn't get the right JSONDon't you know what to do? I made it in colour here: I'm blank
Last edited by yugi1024 (Nov. 28, 2014 20:22:28)
- Tropic
-
1000+ posts
How to hack your own magic custom blocks
Didn't you understand the code in the JSON file? Or didn't you find it?I mean I didn't get the right JSONDon't you know what to do? I made it in colour here: I'm blank
- awesomeness01
-
97 posts
How to hack your own magic custom blocks
Can you put a reporter in the place of a block such as
move () stepsso you can essentially run the content of the variable as a regular block?
when green flag clicked
()
- awesomeness01
-
97 posts
How to hack your own magic custom blocks
Wrong! I've done it countless times. I really want to tell you something. It does not work.
- yugi1024
-
30 posts
How to hack your own magic custom blocks
I got the file, but it was a lot different from the example.Didn't you understand the code in the JSON file? Or didn't you find it?I mean I didn't get the right JSONDon't you know what to do? I made it in colour here: I'm blank