Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to hack your own magic custom blocks
- SuperDoom
- Scratcher
1000+ posts
How to hack your own magic custom blocks
You got the BBCode wrong. It should be:
define Fill [list] with [a],(n) times
repeat (n)
add (a) to (list)
end
Last edited by SuperDoom (Dec. 22, 2014 00:40:25)
WARNING: Anything I post is either stupid, sarcastic, or ironic. I am not to be taken seriously. Feel free to make fun of me for anything I say.
“Those who would give up essential Liberty, to purchase a little temporary Safety, deserve neither Liberty nor Safety.”
essentiallibertyisfreedomofspeech~Benjamin Franklin (This is my motto for replying to suggestions.)
As of 83G1NN1NG/0F/71M3, I use color #322F31 for my posts. If it's a link, I use #1AA0D8.
CLICK THIS LINK TO INSTANTLY CRASH THE SERVERS
Alexa, play Space Invaders.
3000 • 3500 █ 4000
As of November 7th, 2019, I have my computer back.
I'm awake from 11:00 AM to 11:30 PM CST (12:00 PM to 12:30 AM EST). Please be more active during that time.
I've moved to -THENEXT_LEVEL-.
- Dylan5797
- Scratcher
1000+ posts
How to hack your own magic custom blocks
Use MY TOOL http://scratch.mit.edu/discuss/topic/76008/
- Tropic
- Scratcher
1000+ posts
How to hack your own magic custom blocks
That probably means you have done something wrong when editing the code. whenever i do what it says and hit upload the project says “the project has failed to load” how can i make it work?
- emeralddog
- Scratcher
100+ posts
How to hack your own magic custom blocks
By the way, do you think you could do an example project with a custom block which creates a cloud variable
I hate people who ask for followers - follow if you agree!
- Tropic
- Scratcher
1000+ posts
How to hack your own magic custom blocks
Looks a bit better nowwhen crazy flag clicked :: events hat
- Tropic
- Scratcher
1000+ posts
How to hack your own magic custom blocks
Creating a cloud variable with a block might be hard, but I have already succeeded with making a custom block that creates a local variable and it can also create a normal variable, but not a cloud variable. By the way, do you think you could do an example project with a custom block which creates a cloud variable
- xsnail
- Scratcher
90 posts
How to hack your own magic custom blocks
%c( [#0F0] )Wouldn't these be cool blocks, especially if<(Blend [#0F0] and [#00F]) = ( [#0FF] )returned true?
Oh, and by the way, does anybody know how to getthe [#F23] thingwith % notation?
- NuclearBlaster
- Scratcher
10 posts
How to hack your own magic custom blocks
Thats hard??? I don't personally think that was hard with Textpad..No, it was It was easy enough to make “corrupt” scratch programs that ran on the scratch system in 1.4much harder. Messing with the binary was practically impossible until Kurt, and simple hacks with shift-click-r (moving variable) didn't normally work with the Java player anyway.
I kinda agree with that, if you use textpad it's simple
- Dragon_Slayer1500
- Scratcher
31 posts
How to hack your own magic custom blocks
I know that. wait , no sorry. a rectangle
- Dragon_Slayer1500
- Scratcher
31 posts
How to hack your own magic custom blocks
There is a block that does that. By the way, do you think you could do an example project with a custom block which creates a cloud variable
- minishark123
- New to Scratch
4 posts
How to hack your own magic custom blocks
point towards noware
switch costume to cunvuzed cat thats weird
- Tropic
- Scratcher
1000+ posts
How to hack your own magic custom blocks
I fixed the colourspoint towards nowhere :: motion
switch costume to cunvuzed cat thats weird :: looks
- Theassasin36
- Scratcher
15 posts
How to hack your own magic custom blocks
Did'nt work for me, gave me an error
- thirdlion
- Scratcher
20 posts
How to hack your own magic custom blocks
wait….wait do you know how you do the first step i did not get that one It worked!, this seems fun anything else you can do?
- minishark123
- New to Scratch
4 posts
How to hack your own magic custom blocks
(distance to my house =30000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 lght years
- endermanjd
- Scratcher
37 posts
How to hack your own magic custom blocks
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: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!
the part when you look in the zip to get the goodies i can't open it can you help me? i have a mac.
endermanjd :: operators
is awesome! :: sound
- Alexcamostyle
- Scratcher
81 posts
How to hack your own magic custom blocks
I have a problem. I'm on a Mac and I can't revert the project back to an .sb2 file. It keeps on reverting to “.sb2.zip”.
Some of my projects:
•(Almost) Infinite Score Engine
•Building Minecraft
•Into Space: An Airformer. (Was curated on the front page!)
•The “Circle” of Life
•Lots O Coins
•Simon (WIP)
- Alexcamostyle
- Scratcher
81 posts
How to hack your own magic custom blocks
Also, is there a way to get a list of variables in a hacked custom block?
Some of my projects:
•(Almost) Infinite Score Engine
•Building Minecraft
•Into Space: An Airformer. (Was curated on the front page!)
•The “Circle” of Life
•Lots O Coins
•Simon (WIP)
- Discussion Forums
- » Help with Scripts
- » How to hack your own magic custom blocks