JaysonNT wrote:
I say in the Block Library a blockspec, which I understand, but what is that additional code?
That is the code that makes the block function. It is called a "method."
Offline
gamer_6 wrote:
i kind of feel stupid about this but... what's squeak?
Offline
complecated... but cool!
Offline
billyedward wrote:
This tutorial will give you a basic feel for the MIT squeak editor, and altering Scratch in general. I have tried to include numerous images and such to make it as clear as possible, but feel free to comment with any suggestions.
Let's begin with the blank gray screen of squeak. First left click on that gray, select “open…,” and select “Scratch/Streak”.
This opens a draggable-around Scratch/Streak window.
To resize hold alt and click on the window, and drag the “”pin.
OK, now do the same as above, but this time select “browser” from the “open” list.
This opens the system browser, what most of the programming will go in to:
The little green circle allows you to resize this window. Just hover over the edge to get it. The X quits the window, the “O” minimizes, and the paper opens the window options. You’ll notice the 4 navigation panes above, and the coding pane below. These let you navigate and change the hierarchy of Scratch/Streak. The “instance|?|class”
Is for the 3 main categories. “Class” generally defines that an object exists, whereas instance defines what it does. ? is for comments, which don’t work. Lets get started. Navigate as follows: 1 Scratch-Objects, 2 ScriptableScratchMorph, 3 Class, 4 Scratch, 5 Blockspecs:
See how I highlighted “(‘if %b’ #c #doIfElse)”? This is the basic syntax for defining the existence of a block. There is:
• opening bracket
• single quote
• The text to be displayed on the block, input areæ represented by %letter, such as %n is a numerical inserter, %b is Boolean. Here's the full list:Code:
a:attribute of another sprite, such as X position or size. b:a boolean inserter c:a colour picker that shows the menu. C:a colour picker that doesn't d: the sprite direction menu/numerical inserter. D: the menu for midi drums e: The broadcast message menu f: math function menu (with sin, abs, etc.) g: menu for the different graphic effects. h: numerical sensor board selector menu H: boolean sensor board selector menu i: midi instrument menu/numerical inserter k: menu for the names of the different keys, used in the key sensor blocks. l: menu with the costume names of the given sprite. L: list name menu. m: sprite list n: numerical inserter N: note name menu/inserter s: string inserter S: sound selector menu v: variable labels menu y: menu used to delete either a number of the last value or all of a list.• Single quote
• “#” sign.
• Letter representing the block type, - being a normal command block, b is Boolean, r a reporter, c is a bar.
• “#” sign.
• Message to be corresponded in the instance side.
• This may be followed by Another one or few stand alone numbers, # followed by a number, or value in single quotes. These define the default value of the inserters.
• Closing bracket.
The message can also define special forms, such as the above’s corresponding function tells how to do the else bar.
What we now want to do is go over to “obsoleteBlockSpecs.”
Highlight each section…
http://docs.google.com/File?id=dfbw6jtq_8hgcctqcb_b
And Copy/Paste into the corresponding section of “blockSpecs”: (See that ‘numbers’ before? All following this will show under numbers.
http://docs.google.com/File?id=dfbw6jtq_9gp3qj8qg_b
Now right click “accept”
http://docs.google.com/File?id=dfbw6jtq_10fc4ndbhf_b
Et Voila! You’ve resurrected an “obsolete” block!
Repeat this process for the rest. These blocks will work in normal Scratch/Streak, they’ll just be red.
Now that we have the obsoletes’, lets try some other cheats. Go to:
1 Scratch-Objects, 2 ScratchSpriteMorph, 3 Class, 4 Scratch, 5 Blockspecs:
http://docs.google.com/File?id=dfbw6jtq_11gjcfqxhr_b
See in the single quotes of both where it’s says 'color'?
Change this to, say saturation: http://docs.google.com/File?id=dfbw6jtq_12mfv7z8j9_b
Which, when accepted, gives this: http://docs.google.com/File?id=dfbw6jtq_13dhrqhmfp_b, Which produces this:
http://docs.google.com/File?id=dfbw6jtq_14fhp7krfn_b
Neat,eh? Try setting it to blur, pointillize, or water as well!
One more thing: go back to 1 Scratch-Objects, 2 ScriptableScratchMorph, 3 Class, 4 Scratch, 5 Blockspecs, and find the equals block: http://docs.google.com/File?id=dfbw6jtq_15ftx4x6gx_b. See the
‘#- #-‘? This means that the two inserters will be blank. If, however, you put a string into them (replacing the dash), then they will be forced to hold it. How scratch does this is to “temporarily” make it a square string inserter. (http://docs.google.com/File?id=dfbw6jtq_16ck3hc4hb_b) You could also change the “%n” to a “%s” which is the “code” for a string inserter, but that would render it incompatible with normal Scratch/Streak. Using the above methods you can also make entirely new blocks: http://docs.google.com/File?id=dfbw6jtq_17zfzs5fgb_b
And force stuff into other blocks:
Another thing you can do is:
Drag a block out to the gray, and Alt+click it.
Click the red menu icon, and select change colour…
Edit as you wish… And use in your Scripts!
Certain other blocks can only easily be gotten by going to the version of Scratch/Streak it came from. The 1.2beta comment block is an example:
It’ll show up red in everything after 1.1, gray in 1.2beta. It is obsolete before 1.2.
Hope this helps in your endeavor to utilise the scratch source code!
I will make a more advanced collection of information soon, for those who want to continue.
<when[ This Makes Sense ]
<change{ one of the things i've understood! }by(1)
This Makes No Sense
Offline
I can't change the variable and list colors. Also, the top of every hat block stays the same.
Offline
Com'on, I want the real blocks! Can you give me all the blockspecs and codes and stuff all at once? I really want those blocks! Please?!?
EDIT: Better yet, you could add them to my website at http://customblocks.weebly.com/scratch-blocks.html. (Scroll to the bottom of the page.)
Last edited by legomany3448 (2011-05-09 16:46:17)
Offline
I only learned how to Squeak three days ago. And I have been at the block library a lot, and I would like to ask, in the library there is a block to change the color of the list watcher, but I need to know what I need to edit to turn it into a block to change the color of the variable watcher.
This is the list watcher color changer. What do I need to change to make it work for the variable watcher instead?
Blockspec:
('set the list blocks color to %c' #- #setListBlockColorSelf:)
Code: (place under sensing ops)
setListBlockColorSelf: t1
ListBlockColor _ t1
Offline
It only works because the list blocks' color is stored in a variable. If you edit Scratch-Objects -> ScriptableScratchMorph -> block specs -> blockSpecColorDic: (something like that) to change the variable block color, it will also change the watcher color.
Offline
I don't have Scriptable Scratch Morph- Scratch- Blockspecs!
Offline
I tried adding a block and it didn't work!
Offline
What version of Scratch does this use, 1.2, 1.3, or 1.4?
Offline
pokemongardevoir wrote:
I tried adding a block and it didn't work!
You might not be using the correct version of Scratch.
Offline
. Can you explain what the gray, select open means? I thought you meant file, then open and then select Scratch/Streak but it wasn't in there. What do you mean then?
Offline
cool. i wanted to know how to do this so i can make a scratch mod and now i can!
Offline
Offline
Really cool (although my head hurts after reading this. lol)
Offline