Here's my BYOB block, "[] = []" ! I know you're all like "There's already a [] = [] block!", but this block is built to get around the case-insensitiveness of the standard [] = [] block. Usually Scratch will report A=a as being true (even though one is uppercase and one is lowercase), but my block gets around this by using the ASCII values! Here's the code, enjoy! http://concat.jcshome.org/stuff/equals block.jpg
Edit: the above link no longer works, use this instead: http://i38.tinypic.com/1z23xco.jpg
Last edited by meowmeow55 (2010-08-27 20:09:18)
Offline
meowmeow55 wrote:
Here's my BYOB block, "[] = []" ! I know you're all like "There's already a [] = [] block!", but this block is built to get around the case-insensitiveness of the standard [] = [] block. Usually Scratch will report A=a as being true (even though one is uppercase and one is lowercase), but my block gets around this by using the ASCII values! Here's the code, enjoy! http://concat.jcshome.org/stuff/equals block.jpg
I had that idea but this work better.
_________ / \______ |(1 = A) = (2 = a)| |_________________| [report [<(list [(1)] < >) contains [(2)]>]]
Last edited by MathWizz (2010-08-05 22:39:45)
Offline
Thanks!
Offline
Panther block: Based on code by nXIII. <String Contains String>
Box 1:
$String$ contains $String$
box 2
b
box 3
^ t1 includesSubString: t2
(His is a reported this is a boolean.)
Offline
midnightleopard wrote:
Panther block: Based on code by nXIII. <String Contains String>
Box 1:
$String$ contains $String$
box 2
b
box 3
^ t1 includesSubString: t2
(His is a reported this is a boolean.)
ah thank you, that was a mistake on my part, I should have put b not r, so I'm afraid that that block has been shared already
Offline
Offline
meowmeow55 wrote:
Here's my BYOB block, "[] = []" ! I know you're all like "There's already a [] = [] block!", but this block is built to get around the case-insensitiveness of the standard [] = [] block. Usually Scratch will report A=a as being true (even though one is uppercase and one is lowercase), but my block gets around this by using the ASCII values! Here's the code, enjoy! http://concat.jcshome.org/stuff/equals block.jpg
Thats a brillant idea, nicely done.
jman13 wrote:
How do I save the image for a BYOB block?
The block
make sure that the scripting area is clear besides the block you want to take a picture of.
then right click on the scrpting area background and click save pciture of scripts.
The code
Option 1. (You can do this unless you use the report area below the scripting area)
Do the same as The block
Option 2. Right click on the stage and click grab screen region, then click and drag on the area of the scripting you want to save. then export the costume.
Last edited by markyparky56 (2010-08-09 15:06:51)
Offline
sparks wrote:
midnightleopard wrote:
Panther block: Based on code by nXIII. <String Contains String>
Box 1:
$String$ contains $String$
box 2
b
box 3
^ t1 includesSubString: t2
(His is a reported this is a boolean.)ah thank you, that was a mistake on my part, I should have put b not r, so I'm afraid that that block has been shared already
oh cool
Offline
Here's a simple one!
Negative ()
Blockspecs:
('Negative %n' %r negativeOfNumber:)
Instance:
negativeOfNumber: t1
^t1_ t1*-1
Offline
or
^ 0 - t1.
Offline
Not that I see the usefulness of it, but why would you need that when you could just do:
[blocks]
((0 <-> <{ t1 }> ))
[/blocks]
Offline
I've got a new BYOB block!
I got the idea from one of coconut's projects.
Offline
Panther block:
first box:
Create squeak error
Second box:
g
third box
self duplicateNoAttach
this block couldn't have less of a point, unless you want a squeak error.
Offline
midnightleopard wrote:
Panther block:
first box:
Create squeak error
Second box:
g
third box
self duplicateNoAttach
this block couldn't have less of a point, unless you want a squeak error.
thanks for sharing! ... any reason why it's a colour reporter? (theyve been taken out of 1.1 and replaced with normal variables that can reprort colours )
Offline
sparks wrote:
http://www.weebly.com/uploads/4/0/7/6/4 … 89.jpg?435
Welcome to your block library! One of the most important and beloved features of Scratch are the blocks, and a great deal of time and effort has gone into making the blocks you see. When building Scratch, the team specifically designed the code so that it would be as easy as possible to add new blocks, and many people have done just that!
This topic aims to bring together a collection of useful block code for experimenting Scratchers to try out and learn from, embracing the program and share parts of the Scratch Motto and hopefully letting users use what they learn here to imagine their own blocks!
This library currently deals with three types of block, and they are displayed under separate headings with explanations or explanatory links to avoid confusion. The three types are
Scratch Block
These blocks can be added directly into scratch.
BYOB Blocks
Built in the popular version of Scratch, BYOB blocks are composed of many other blocks and the code for these will probably be displayed as a block image.
Panther Blocks
Another popular version of Scratch, Panther has a "make a block" feature that lets users easily write block code to do pretty much anything.
So to all you curious Scratchers and viewers alike, I bid you welcome. Welcome to the Library!
===============================================================================
http://www.weebly.com/uploads/4/0/7/6/4 … 51.gif?111
===============================================================================
How to add one of these blocks to Scratch:
I suggest visiting this excellent forum page. It has a full explanation from Billyedward. You can also look at this detailed explaination on the layout of blockspecs by ScratchReallyRocks
_______________________________________________________________________________
Control
"Record sound" block Shared by Sparks
type: http://wiki.scratch.mit.edu/images/The_ … _Block.png
blockspec:Code:
'record sound' #- #recordSoundno code needed
What it does:
Opens the sound recording window and lets you record a sound.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
"open camera window" block Shared by Sparks
type: http://wiki.scratch.mit.edu/images/The_ … _Block.png
blockspec:Code:
'open camera window' #- #takePhotono code needed
What it does:
Opens the webcam control window and lets you take photos.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
"save project as..." block Shared by Billybob-Mario
type: http://wiki.scratch.mit.edu/images/The_ … _Block.png
blockspec:Code:
'save project' #- #saveProjcode:
Code:
saveProj | t1 | t1 _ self ownerThatIsA: ScratchFrameMorph. t1 saveScratchProjectWhat it does:
opens the save project as dialog and lets you save it!
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Pen
"pen size" block Shared by jonathanpb
type: http://wiki.scratch.mit.edu/images/The_ … _Block.png
blockspec:Code:
'pen size' #r #penSizeno code needed
What it does:
Reports the current pen size.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
"pen down?" block Shared by zorket
type: http://wiki.scratch.mit.edu/images/The_ … _block.png
blockspec:Code:
'pen down?' #b #penDownno code needed
What it does:
Reports wether the pen for that sprite is down or not.
===============================================================================
http://www.weebly.com/uploads/4/0/7/6/4 … 586.jpg?94
===============================================================================
how to add one of these blocks:
You need to download BYOB (Build Your Own Blocks) from this link to use the blocks shared in this section. A really helpful guide to understanding how to build your block can be found at this forum thread
To save space on this thread, any BYOB blocks shared will be displayed as links to images, rather than embedding the images to this thread directly. Just read the block description and click the link to the image if you want it.
_______________________________________________________________________________
Motion
[go to random X Y position] By jonathanpb
[turn clockwise( )° in ( ) secs] By PlayWithFire
Looks
[previous costume] By jonathanpb
[change costume by (n)]By jonathanpb
[switch to random costume]By jonathanpb
[animate costumes( ) through( ) with ( ) secs delay] By PlayWithFire
[go forward ( ) layers] By PlayWithFire
Operators
(pi) By PlayWithFire
(( )^( )) (to power) By PlayWithFire
<[]=[]> By meowmeow55Note, unlike the normal equals boolean, this one is case sensitive!
Pen
[stamp at X ) Y )] By PlayWithFire
Sensing
<clicked?> By PlayWithFire
<mouse touching edge?> By PlayWithFire
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
================================================================================
http://www.weebly.com/uploads/4/0/7/6/4 … 986755.jpg
================================================================================
How to add one of these blocks:
To use the Panther coded blocks, you need to download Panther from this link.
To add a block code, you need to open Panther, go to the variables tab, scroll down and click the "make a block" button at the bottom. You will get a popup window with three text boxes and a colour square. The long thin one at the top needs to have the block name in it. The square one to the right with a "-" in it defines the type of block (reporter, stack etc.) and the large one below them is for the block code.
________________________________________________________________________________
Control
"Record sound" Block shared by: Sparks
box 1:
Record sound
box 2
-
box 3
self recordSound
What this block does:
this block opens the sound recorder and lets you record sound.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
"open camera window" Block shared by: Sparks
box 1:
open camera window
box 2
-
box 3
self takePhoto
What this block does:
this block opens the camera window and lets you take photos.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
"open webpage with URL [http://]" Block shared by: Billyedward
box 1:
open browser with URL $String$
box 2
-
box 3
Cursor wait showWhile:[ScratchPlugin primOpenURL: t1]
What this block does:
this block opens your default web browser with the webpage typed into the box if the browser is already open, it will open the page in a new tab on firefox, a new window in internet explorer).
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
"clone me" Block shared by: Unknown
box 1:
clone me
box 2
-
box 3
self duplicateNoAttach
What this block does:
This block creates a clone of the sprite that runs it. Unlike the standard clone blocks in Panther, this one creates a clone that does not dissapear once the stop button is pressed. If you want the clone to appear at the mouse pointer and let you place it, just don't put the NoAttach part into the CYOB window. note, does not work in presentation mode.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
"permenantly delete me" Block shared by: Unknown
box 1:
permenantly delete me
box 2
-
box 3
self undoableDeleteSprite
What this block does:
This block permenantly deletes the sprite that runs it. Unlike the standard delete block in Panther, this block can delete originial (not a clone) sprites so use it with care. note, does not work in presentation mode.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
"save project as..." Block shared by: Billybob-Mario
box 1:
save project as...
box 2
-
box 3
| t1 |
t1 _ self ownerThatIsA: ScratchFrameMorph.
t1 saveScratchProject
What this block does:
This block opens the save window and prompts you to save the project.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Variables
"set background watcher colour of [ ] to [ ]" Block shared by: Unknown
box 1:
permenantly delete me
box 2
-
box 3
"permenantly delete me" Block shared by: nXIII
box 1:
set bg of $Variable$ to $Color$
box 2
-
box 3
| s frame w b palette |
s _ self.
(self varNames includes: t1) ifFalse: [(s _ self ownerThatIsA: ScratchStageMorph) ifNil: [^ self]].
(s varNames includes: t1) ifFalse: [^ self].
frame _ self ownerThatIsA: ScratchFrameMorph.
frame ifNil: [
(w _ self ownerThatIsA: OffscreenWorldMorph) ifNil: [^ self].
frame _ w frame].
What this block does:
This block permenantly deletes the sprite that runs it. Unlike the standard delete block in Panther, this block can delete originial (not a clone) sprites so use it with care. note, does not work in presentation mode.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Operators
"[] contains []?" Block shared by: nXIII
box 1:
$String$ contains $String$?
box 2
b
box 3
^ t1 includesSubString: t2
What this block does:
This block tells you wether the text in the first box contains the text in the second. Excellent for searching for keywords in an input answer.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Want to add to the library? Please do! comment below for it to be added above.
maybe you should call it blocklabray
Offline
sparks wrote:
midnightleopard wrote:
Panther block:
first box:
Create squeak error
Second box:
g
third box
self duplicateNoAttach
this block couldn't have less of a point, unless you want a squeak error.thanks for sharing! ... any reason why it's a colour reporter? (theyve been taken out of 1.1 and replaced with normal variables that can reprort colours )
well, a reporter will work as well I think.
Offline