Can't see images in the block library? Hopelessly unable to browse our collection of over 350 blocks? All you need to do is install Rookwood101's Antidiote script and you'll soon be able to see once more!
.
.
.
.
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!
Can I use these blocks in my Scratch Modification?
Just click on one of the block images below to find blocks for Scratch, BYOB and Panther!
So to all you curious Scratchers and viewers alike, I bid you welcome. Welcome to the Library!
Your Local Block Library Block Count:
_________________________________
Want to add to the library? Please do! Comment below for it to be added.
_________________________________
Librarians
Sparks About Sparks
SSBBM About SSBBM
Pecola1 About Pecola1
Scimonster About Scimonster
Meowmeow55
Greenatic About Greenatic
YourLocalBlockLib The Block Library Experience
Past Librarians
Thesuccessor About Thesuccessor
Special thanks to coolstuff for pushing to get this Itopiced, fullmoon for helping with the account, nXIII for doing a lot of the excellent graphics and everyone who posted their block code and asked for this to be Itopiced, we couldn't have done it without you!
Read Also: Our Scratch Wiki Page
Last edited by YourLocalBlockLib (2012-01-13 07:15:04)
Offline
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 explanation on the layout of blockspecs by ScratchReallyROCKS.
To install a block importer in Scratch to automatically add a (downloadable) block for you, click here! But beware, this feature is untested and does not currently work!
Choose a block type to view, or scroll down this page to see more!
Motion
Control
Looks
Sensing
Sound
Operators
Pen
Variables
home
Last edited by YourLocalBlockLib (2011-08-23 14:47:10)
Offline
Motion
Shared by MarioBlender
Blockspec:
('make %m move %n steps' #- #move:forward:)
Code:
move: sprite forward: distance
sprite forward: distance
What this block does:
Lets a sprite move another sprite without having to use a broadcast.
Shared by MathWizz
Blockspec:
('if touching %m bounce' #- #bounceOffSprite:)
Code:
bounceOffSprite: aName
| sprite oldDir |
sprite _ self coerceSpriteArg: aName.
(self touching: sprite)
ifFalse: [^ self].
oldDir _ self heading.
self pointTowards: sprite.
self turnRight: self heading - oldDir + 180.
[self touching: sprite]
whileTrue: [self forward: 1]
What this block does:
Causes the sprite to bounce off the selected sprite if touching it. (Assumes the sprite is a circle.)
Shared by jslomba
Blockspec:
('if %b bounce' #- #bounceIfBoolean:)
Code:
bnceIfBoolean: condition
condition ifTrue: [self turnRight: 180]
What this block does:
Causes the sprite to bounce if the condition is true.
Shared by Pecola1
Blockspec:
('set rotation style to %r' #- #rotationStyle:)
Code:
No code needed
Scratch objects> ScratchSpriteMorph>motion ops
rotationStyleChanger
^ #('normal' 'leftRight' 'none' )
Scratch-Blocks> CommandBlockMorph>> -- all -- > uncoleredArgMorphFor:
add the strip...
$r = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #rotationStyleChanger;
choice: 'normal'].
What this block does:
Allows you to change the rotation style of a sprite.
Shared by Pecola1
Blockspec:
('rotation style' #r #rotationStyle)
Code:
rotationStyle
^ rotationStyle
What this block does:
Reports a sprite's rotation style.
Shared by StrykerV
Blockspec:
('point at x:%n y:%n' #- #pointToX:y:)
Code:
No code needed
What this block does:
Points the sprite at the specified region of the stage.
Shared by Hardmath123
Blockspec:
('point at random coordinate' #- #randxypos)
Code:
randxypos self gotoX: (self randomFrom: -240 to: 240) y: (self randomFrom: -180 to: 180)
Shared by Hardmath123 and made with Scramble
Blockspec
('Arrow key move with speed %n ' #- #arrowMove:)
Code:
arrowMove: i1
"Made using Scramble by Hardmath123"
| t4 t3 t2 t1|
t1_ 'up arrow'.
t2_ 'down arrow'.
t3_ 'left arrow'.
t4_ 'right arrow'.
t1_ self keyPressed:t1.
t2_ self keyPressed:t2.
t3_ self keyPressed:t3.
t4_ self keyPressed:t4.
t1 ifTrue: [
self gotoX: self xpos y: (i1+ self ypos).
].
t2 ifTrue: [
t2_i1 * -1.
self gotoX: self xpos y: (t2+ self ypos).
].
t3 ifTrue: [
t3_i1 * -1.
self gotoX: (t3+self xpos) y: self ypos.
].
t4 ifTrue: [
self gotoX: (i1+self xpos) y: self ypos.
].
What this block does:
Move around using the arrow keys at the specified speed.
Shared by SSSS
Blockspec:
('draggable?' #b #draggable)
Code:
no code needed
What this block does:
Reports whether or not the sprite is draggable.
Shared by Greenatic
Blockspec:
('go %n% of the way to x: %n y: %n' #- #Distance:X:Y:)
Code:
Distance: t1 X: t2 Y: t3
| newX newY |
newX _ t1 * 0.01 * (t2 - self xpos).
newY _ t1 * 0.01 * (t3 - self ypos).
self gotoX: newX + self xpos y: newY + self ypos
What this block does:
Moved a percentage of the distance to a spot.
Shared by Greenatic
Blockspec:
('go %n % of the way to %m' #- #Distance:Sprite:)
Code:
Distance: t1 Sprite: t2
| t3 t4 newX newY |
t2 = #mouse
ifTrue:
[newX _ self mouseX * (t1 * 0.01).
newY _ self mouseY * (t1 * 0.01).
self gotoX: newX + self xpos y: newY + self ypos].
ifFalse:
[t3 _ self coerceSpriteArg: t2.
t4 _ t3 referencePosition.
newX _ t4 x * (t1 * 0.01).
newY _ t4 y * (t1 * 0.01).
self gotoX: newX + self xpos y: newY + self ypos]
What this block does:
Moved a percentage of the distance to a spot.
Shared by Greenatic and jslomba
Blockspec:
('go in between x: %n y: %n and x: %n y: %n' #- #betweenX:Y:X:Y:)
Code:
betweenX: t1 Y: t2 X: t3 Y: t4
| newX newY |
newX_ (t1 + t3) / 2.
newY_ (t2 + t4) / 2.
self referencePosition: newX @ newY
What this block does:
Goes to the middle location between two specified locations.
Shared by Greenatic, improved by Scimonster
Blockspec:
('make %m draggable' #- #MakeDraggable:)
Code:
MakeDraggable: t1
t1 draggable: true
What this block does:
Makes the sprite put in the dropdown menu draggable.
Shared by Greenatic, improved by Scimonster
Blockspec:
('make %m undraggable' #- #MakeUndraggable:)
Code:
MakeUndraggable: t1
t1 draggable: false
What this block does:
Makes the sprite put in the dropdown menu un-draggable.
For these 2 blocks, go to Scratch-Blocks >> SpriteArgMorph >> other >> presentMenu, and paste in the following code:
presentMenu | t1 t2 t3 t4 t5 | (t1 _ self ownerThatIsA: ScratchFrameMorph) ifNil: [^ self]. (owner isKindOf: CommandBlockMorph) ifTrue: [t2 _ owner selector]. t3 _ t1 scratchObjects. t3 sort: [:t6 :t7 | t6 objName asLowercase < t7 objName asLowercase]. t4 _ CustomMenu new. t2 = #getAttribute:of: ifTrue: [t4 add: 'Stage' localized asUTF8 action: t1 workPane] ifFalse: [(t2 = #MakeUndraggable: | t2 = #MakeDraggable:) ifFalse: [t4 add: 'mouse-pointer' localized asUTF8 action: #mouse. t2 = #touching: ifTrue: [t4 add: 'edge' localized asUTF8 action: #edge]. t3 _ t3 copyWithout: owner receiver]]. t3 size > 0 ifTrue: [t4 addLine]. t3 do: [:t8 | t4 add: t8 objName action: t8]. (t5 _ t4 startUp) ifNil: [^ self]. morph _ t5. self fixGetAttribueBlock. self updateLabel
This removes "mouse-pointer" from the menu.
Shared by Greenatic
Blockspec:
('make me draggable' #- #MakeDraggable)
Code:
MakeDraggable
draggable _ true
What this block does:
Makes the sprite draggable.
Shared by Greenatic
Blockspec:
('make me undraggable' #- #MakeUndraggable)
Code:
MakeUndraggable
draggable _ false
What this block does:
Makes the sprite un-draggable.
Shared by Greenatic
Blockspec:
('move %n steps towards %m' #- #Move:Towards:)
Code:
Move: t1 Towards: t2 | t3 t4 t5 t6 t7 t8 t9 | t2 = #mouse ifFalse: [t3 _ t2 xpos @ t2 ypos - self referencePosition]. t2 = #mouse ifTrue: [t3 _ self mouseX rounded @ self mouseY - self referencePosition]. t4 _ t3 x abs < 0.001 ifTrue: [t3 y < 0 ifTrue: [90] ifFalse: [270]] ifFalse: [((t3 x >= 0 ifTrue: [0] ifFalse: [180]) - ((t3 y / t3 x) arcTan * 57.2957795131)) rounded]. t5 _ t4 degreesToRadians. t6 _ t5 cos @ t5 sin * t1. t7 _ self position + t6. t8 _ t7 x. t9 _ t7 y. t8 isNaN ifTrue: [t8 _ 0]. t8 isInf ifTrue: [t8 _ t8 sign * 10000]. t9 isNaN ifTrue: [t9 _ 0]. t9 isInf ifTrue: [t9 _ t9 sign * 10000]. self position: t8 @ t9. self keepOnScreen
What this block does:
Moves toward a sprite. An advantage over this script is that the direction can be used for something else.
^ Back to Scratch Blocks
^ Back to Contents
█ █ █ █ █ █ █ █
Last edited by YourLocalBlockLib (2012-04-24 13:30:12)
Offline
Control
Shared by Sparks
blockspec:
('open camera window' #- #takePhoto)
no code needed
What it does:
Opens the webcam control window and lets you take photos.
Shared by Billybob-Mario
blockspec:
('save project' #- #saveProj)
code:
saveProj
| t1 |
t1 _ self ownerThatIsA: ScratchFrameMorph.
t1 saveScratchProject
What it does:
Opens the save project as dialog and lets you save it!
Shared by bbbeb
blockspec:
('press green flag' #- #pressGreenFlag)
code:
pressGreenFlag
#pressGreenFlagButton
What it does:
Triggers all scripts starting with a "when green flag clicked" hat. Note: This block is glitched, it won't work on a when flag clicked hat block, instead you can use 'self broadcast: 'Scratch-StartClicked' ' (info)
Shared by zorket
blockspec:
('go to scratch website' #- #link)
code
link
Cursor wait showWhile: [ScratchPlugin primOpenURL: 'http://scratch.mit.edu/']
What it does:
Opens the Scratch homepage!
Shared by rubiks_cube_guy238
blockspec:
('%e received?' #b #seesBroadcast:)
code
seesBroadcast: t1
| t2 |
t2 _ ScratchEvent allInstances.
t2
reverseDo:
[:t3 |
t3 name = t1 ifTrue: [^ true].
nil].
^ false
What it does:
Lets you test to see if a broadcast is being sent. Much sought after and requested.
Shared by lots of people
blockspec:
('clone me' #- #duplicateNoAttach)
no code needed
What it does:
This block creates a clone of the sprite that runs it. Note: this block does not work in presentation mode.
Shared by lots of people
blockspec:
('delete me' #- #undoableDeleteSprite)
no code needed
What it does:
This block permanently deletes the sprite that runs it. Note: this block does not work in presentation mode.
Shared by Zorket
Blockspec:
('set single stepping' #- #setSpeed)
Code:
setSpeed
| t1 t2 |
t1 _ CustomMenu new title: 'Single-step speed?'.
t1 add: 'Turbo speed' action: 0.
t1 add: 'Normal' action: 1.
t1 add: 'Flash blocks (fast)' action: 30.
t1 add: 'Flash blocks (slow)' action: 200.
t2 _ t1 localize startUp.
t2 ifNil: [^ self].
ScratchProcess blockHighlightMSecs: t2
What it does:
This block lets you change the speed of your project! Very useful when you want a mix of fast computing and good graphics.
Shared by Pecola1
Blockspec:
('show cursor' #- #showCursor)
Code:
showCursor
World activeHand showTemporaryCursor: nil
What it does:
Shows the cursor (use with hide cursor block below).
Shared by Pecola1
Blockspec:
('hide cursor' #- #hideCursor)
Code:
hideCursor
World activeHand showTemporaryCursor: ((Form extent: 1 @ 1 depth: 32)
fillColor: Color transparent)
What it does:
Hides the cursor (use with show cursor block above).
Shared by Pecola1
Blockspec:
('enable programmer facilities' #- #enableProgrammerFacilities)
Code:
enableProgrammerFacilities
Preferences enableProgrammerFacilities
What it does:
Enables the programmer facilities (info).
Shared by Pecola1
Blockspec:
('disable programmer facilities' #- #disableProgrammerFacilities)
Code:
disableProgrammerFacilities
Preferences disableProgrammerFacilities
What it does:
Disables the programmer facilities. Note: do not use until you make the enable programming facilities block. (info)
Shared by Pecola1
Blockspec:
('quit Scratch' #- #exitScratch)
Code:
exitScratch
Smalltalk snapshot: false andQuit: true
What it does:
Closes Scratch. Either save the image before testing it, or test and add it again after you reopen it.
How to make it a cap block:
1) Go to Scratch-Blocks >> CommandBlockMorph >> accessing >> isStop
2) Add the following code:
| (selector = #whatYourMethodIsCalled)
Shared by Pecola1
Blockspec:
('reverse' #c #doBackwards)
Code (Scratch-Execution Engine»ScratchProcess»private-special forms):
doBackwards
| t1 t2 |
t1 _ stackFrame expression.
t2 _ stackFrame arguments.
self popStackFrame.
self pushStackFrame: (ScratchStackFrame new expression: t1 firstBlockList reversed)
What it does:
Runs the blocks in the input backwards (if you had [say [hello]] [move (10) steps] it would do [move (10) steps] [say [hello]]) Note: Any C-block goes under Scratch-Execution Engine»ScratchProcess»private-special forms
Shared by Pecola1
Blockspec:
('shuffle' #c #doScramble)
Code (Scratch-Execution Engine»ScratchProcess»private-special forms):
doScramble
| t1 t2 |
t1 _ stackFrame expression.
t2 _ stackFrame arguments.
self popStackFrame.
self pushStackFrame: (ScratchStackFrame new expression: t1 firstBlockList shuffled)
What it does:
Runs the blocks in the input in a random order.
Shared by Pecola1
Blockspec:
('run' #c #doForwards)
Code (Scratch-Execution Engine»ScratchProcess»private-special forms):
doForwards
| t1 t2 |
t1 _ stackFrame expression.
t2 _ stackFrame arguments.
self popStackFrame.
self pushStackFrame: (ScratchStackFrame new expression: t1 firstBlockList)
What it does:
Runs the blocks in the input. Useful only in the scramble and reverse blocks.
Shared by zorket, based on the block by Pecola1
Blockspec:
('close Scratch' #- #quitScratch)
Code:
quitScratch
| t1 |
t1 _ self ownerThatIsA: ScratchFrameMorph.
t1 quitScratch
What it does:
Acts like if you click the "X" in the top right corner (Windows). See the quit Scratch block by Pecola1 for instructions on making a cap.
Shared by ProgrammingFreak, improved by Hardmath123, improved by Scimonster
Blockspec:
('Go to url %s . Http prefix included? %b' #- #gotourl:httpIncluded: 'scratch.mit.edu')
Code:
gotourl: t1 httpIncluded: t2
| url |
url _ t1.
t2 ifFalse: [url _ 'http://' , t1].
Cursor wait showWhile: [ScratchPlugin primOpenURL: url]
What it does:
This block opens a URL and adds the http:// prefix if the boolean is false (or empty).
Shared by Hardmath123
Blockspec:
('Open the %n th forum page' #- #openForum: 58790)
Code:
openForum: url
Cursor wait showWhile: [ScratchPlugin primOpenURL: 'http://scratch.mit.edu/forums/viewtopic.php?id=' , url asString]
What it does:
Opens the Scratch forums topic with the inputted ID.
Default value is the Block Library.
Shared by Hardmath123
Blockspec:
('Post on the %nth forum topic' #- #postForum: 58790)
Code:
postForum: t1
Cursor wait showWhile: [ScratchPlugin primOpenURL: 'http://scratch.mit.edu/forums/post.php?tid=' , t1 asString]
What it does:
Opens the post dialog for the specified forum ID.
Default value is the Block Library.
Shared by Hardmath123
Blockspec:
('pause' #- #pause)
Code:
pause
DialogBoxMorph warn: 'Paused: Click OK to continue'
What it does:
Opens a dialog box that says "Paused: Click OK to continue."
Shared by jslomba, improved by TheSuccessor
Blockspec:
('' #W #-)
Code:
ScratchFrameMorph->processWhenConditions and
OffscreenWorldMorph->processWhenConditions
Delete this line:
true ifTrue: [^ self]
Shared by jslomba, based on the Panther block by Sparks
Blockspec:
('open scratch user %s s my stuff page ' #- #Userlink:)
Code:
Userlink: t1
Cursor wait showWhile: [ScratchPlugin primOpenURL: 'http://scratch.mit.edu/users/' , t1 asString]
What this block does:
Opens the my stuff page of the entered user.
Shared by SSSS
Blockspec:
('Import theme %s') #- #themepacks:)
Code:
themepacks: t1
ScratchFrameMorph readSkinFrom: (FileDirectory default directoryNamed: t1)
What this block does:
You download the ScratchSkin, edit it, then you can use this block to import the skin during a project.
Shared by Pecola1
Blockspec:
('add %s to clipboard' #- #copy:)
Code:
copy: t1
ScratchTranslator unicodeClipboardPut: t1
What this block does:
Adds the text to your clipboard!
^ Back to Scratch Blocks
^ Back to Contents
█ █ █ █ █ █ █ █
Last edited by YourLocalBlockLib (2011-09-09 03:49:35)
Offline
Looks
Shared by Jwosty
blockspec:
('say nothing' #- #sayNothing)
no code needed
Shared by sonicjosh
blockspec:
('paint new costume' #- #drawNewCostume)
no code needed
What it does:
Opens the paint editor and lets you paint a new sprite. Good for games where people want to choose their own avatars.
Shared by coupdegrace
blockspec:
('go forward %n layers' #- #goFwdByLayers: 1)
Code:
goFwdByLayers: t1
owner ifNil: [^ self].
self layer: (owner submorphs indexOf: self)
- t1 truncated
What it does:
Moves your sprite forward the specified amount of layers. Note: this can also be achieved by typing a negative number into the go back %n layers block
Shared by Pecola1
Click here for the 6 stage panning blocks.
What these blocks do:
Pan the stage background around.
Shared by Jens Mönig
blockspec:
('h flip' #- #hFlip)
Code:
hFlip
costume form: (self form flipBy: #horizontal centerAt: 0 @ 0).
self costumeChanged
What this block does:
Flips a sprite horizontally to give a mirror image costume.
Shared by owetre18, based on the above block
Blockspec:
('v flip' #- #vFlip)
Code:
vFlip
costume form: (self form flipBy: #vertical centerAt: 0 @ 0).
self costumeChanged
What this block does:
Flips a sprite vertically to give a mirror image costume.
Shared by Pecola1
blockspec:
('grab screen region for new sprite' #- #grabSpriteFromScreen)
Code:
no code needed
What it does:
Lets you grab a region of the screen to make a new sprite with.
Shared by Pecola1
blockspec:
('save picture of stage' #- #stageShot)
Code:
no code needed
What it does:
Lets you save a picture of the stage.
Shared by Pecola1
blockspec:
('grab a new costume from stage' #- #grabFromScreen)
Code:
no code needed
What it does:
Lets you grab a region of the screen to make a new costume.
Shared by Pecola1
blockspec:
('layer #' #r #layer)
Code:
layer
^ owner submorphs indexOf: self
What it does:
Reports the layer number of the sprite.
Shared by Pecola1
blockspec:
('go to layer %n' #- #layer:)
Code:
no code needed
What it does:
Moves the sprite to a new layer.
Shared by Pecola1
blockspec:
('name of costume # %n' #r #costumeNameFromNumber:)
Code:
no code needed
What it does:
Reports the name of the costume number.
Shared by Scratchycat123
blockspec:
('hidden?' #b #isHidden)
Code:
no code needed
Shared by Hardmath123
blockspec:
('Jump forward %n costumes' #- #nextCostume: 2)
Code:
nextCostume: t1
self costumeIndex: self costumeIndex + t1
Shared by jslomba and made with Scramble
blockspec:
('animate costumes %n to %n with %n seconds in between %n times' #- #Anmat:Anmat:Anmat:Anmat:)
Code:
Anmat: i1 Anmat: i2 Anmat: i3 Anmat: i4
| t1 |
i4
timesRepeat:
[self lookLike: 1 + self costumeIndex.
t1 _ self costumeIndex.
t1 = i2 ifTrue: [self lookLike: i1].
(Delay forSeconds: i3) wait]
Shared by Hardmath123 and made with Scramble, improved by Greenatic (This block may also be used with backgrounds.)
Blockspec:
('Number of costumes' #r #numOfCos)
Code:
numOfCos
"Made using Scramble by Hardmath123"
| t1 |
t1 _ 0.
media do: [:t2 | t2 isImage ifTrue: [t1 _ t1 + 1]].
^ t1
Shared by Hardmath123 and made with Scramble
Blockspec:
('Switch whether hidden or shown' #- #switchHide)
Code:
switchHide
"Made using Scramble by Hardmath123"
| t1|
t1 _ self isHidden.
t1 ifTrue: [
self show.
].
t1 ifFalse: [
self hide.
].
Shared by Hardmath123
Blockspec:
('Get the name of costume number %n ' #r #costumeNameFromNumber: 1)
Code:
no code needed
Shared by Hardmath123 and made with Scramble
Blockspec:
('Am I on %l ?' #b #onCostume:)
Code:
onCostume: i1
"Made using Scramble by Hardmath123"
| t2 t1|
t1 _ self costumeIndex.
t2 _ self costumeNameFromNumber:t1.
t2 = i1 ifTrue: [
^ true
].
t2 = i1 ifFalse: [
^ false
]
Shared by Baderous
Blockspec:
('height' #r #height)
Code:
no code needed
What this block does:
Reports the height of the sprite.
Shared by Baderous
Blockspec:
('width' #r #width)
Code:
no code needed
What this block does:
Reports the width of the sprite.
Shared by TuragaTreeko
Blockspec:
('area' #r #area)
Code:
area
^self height * self width
What this block does:
Reports the amount of pixels the sprite takes up.
Shared by Greenatic
Blockspec:
('perimeter' #r #perimeter)
Code:
perimeter
^ (2 * self height) + (2 * self width)
What this block does:
Reports the perimeter of the sprite.
^ Back to Scratch Blocks
^ Back to Contents
█ █ █ █ █ █ █ █
Last edited by YourLocalBlockLib (2011-12-17 14:49:08)
Offline
Sensing
Shared by midnightleopard
blockspec:
('%j %s' #- #doThis:on:)
code (place under sensing ops)
doThis: t1 on: t2 'google' = t1 ifTrue: [ScratchPlugin primOpenURL: 'http://www.google.com/#sclient=psy&hl=en&q=' , t2 , '&aq=f&aqi=g5&aql=&oq=&gs_rfai=&pbx=1&fp=ab5cdb1806fef4aa&safe=activet1']. 'yahoo' = t1 ifTrue: [ScratchPlugin primOpenURL: 'http://search.yahoo.com/search;_ylt=Aj.OqjGVrkBmY6mZqA_PSu.bvZx4?p=' , t2 , '&toggle=1&cop=mss&ei=UTF-8&fr=yfp-t-701']. 'scratch.mit.edu/' = t1 ifTrue: [ScratchPlugin primOpenURL: 'http://scratch.mit.edu/' , t2]. 'search scratch for' = t1 ifTrue: [ScratchPlugin primOpenURL: 'http://scratch.mit.edu/pages/results?cx=010101365770046705949:gg_q9cry0mq&cof=FORID:11&q=' , t2 , '&safe=active&sa=search']. 'IMDB' = t1 ifTrue: [ScratchPlugin primOpenURL: 'http://www.imdb.com/find?s=all&q=' , t2]. 'load' = t1 ifTrue: [^ 0]. ^ 0
Code (Scratch-Blocks -> CommandBlockMorph -> private -> uncoloredArgMorphFor:
add a line:
$j = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #engineNames;
choice: 'google'].
Last bit of code (Scratch-Objects -> ScriptableScratchMorph -> sensing ops ->)
engineNames
^ #('google' 'yahoo' 'scratch.mit.edu/' 'search scratch for' 'IMDB' 'load' )
What it does:
Lets you search google, yahoo!, the scratch site, scratch.mit.edu and IMDB! (Opens your default web browser.)
Shared by Hardmath123.
Blockspec:
('costume center' #r #rotationCenter)
Code:
no code needed
What it does:
Reports the costume center.
Shared by LS97
blockspec:
('get %s' #r #getTime: 'date')
Code
getTime: t1
t1 = 'date' ifTrue: [^ Date today].
t1 = 'short date' ifTrue: [^ Date today printFormat: #(1 2 3 $- 2 2 )].
t1 = 'time' ifTrue: [^ Time now].
t1 = 'seconds' ifTrue: [^ Time now seconds].
t1 = 'minutes' ifTrue: [^ Time now minutes].
t1 = 'hours' ifTrue: [^ Time now hours].
t1 = 'day' ifTrue: [^ Date today weekday].
t1 = 'help' ifTrue: [^ 'type date, short date, time, seconds, minutes, day, hours'].
^ self error
What it does:
Reports the date and time, including seconds, minutes, hours, day and date.
Shared by jsombla
Blockspec:
('get %Q' #r #getTime: 'date')
Code:
Scratch-Objects >> ScriptableScratchMorph >> sensing ops
getTime: t1
t1 = 'date' ifTrue: [^ Date today].
t1 = 'short date' ifTrue: [^ Date today printFormat: #(1 2 3 $- 2 2 )].
t1 = 'time' ifTrue: [^ Time now].
t1 = 'seconds' ifTrue: [^ Time now seconds].
t1 = 'minutes' ifTrue: [^ Time now minutes].
t1 = 'hours' ifTrue: [^ Time now hours].
t1 = 'day' ifTrue: [^ Date today weekday].
t1 = 'help' ifTrue: [^ 'type date, short date, time, seconds, minutes, day, hours'].
^ self error
dateTime
^ #('date' 'short date' 'time' 'seconds' 'minutes' 'hours' 'day')
Scratch-Blocks >> CommandBlockMorph> private >> uncoloredArgMorphFor: add a strip:
$Q = t2 ifTrue: [^ ChoiceOrExpressionArgMorph new getOptionsSelector: #dateTime;
choice: 'date'].
What this block does:
Dropdown version of the above block.
Shared by Pecola1.
Click here for the code
What it does:
Adds a lot of other sprite attributes to the original block.
Shared by Pecola1.
Click here for the code (2 blocks)
What it does:
Adds a lot of other keyboard keys to the current blocks.
Shared by Hardmath123
Blockspec:
('distance to x %n y %n' #r #dist:and:)
Code:
dist: t1 and: t2
^ (self xpos - t1 * (self xpos - t1) + (self ypos - t2 * (self ypos - t2))) abs sqrt
What this block does:
Reports the distance of the sprite from a given coordinate.
Shared by Pecola1
Blockspec:
( %m touching %m ?' #b #sprite:touching:)
Code:
sprite: t1 touching: t2 | t3 t4 t5 t6 t7 t8 t9 | t3 _ self coerceSpriteArg: t2. t3 = #mouse ifTrue: [(t4 _ self ownerThatIsA: ScratchStageMorph) ifNil: [^ false]. ^ t1 containsPoint: t4 adjustedCursorPoint]. t3 = #edge ifTrue: [^ t1 isOnEdge]. t1 = #mouse ifTrue: [(t4 _ self ownerThatIsA: ScratchStageMorph) ifNil: [^ false]. ^ t3 containsPoint: t4 adjustedCursorPoint]. (t3 isKindOf: t1 class) ifFalse: [^ false]. (t1 isHidden not and: [t3 isHidden not]) ifFalse: [^ false]. t5 _ t1 bounds intersect: t3 bounds. (t5 width > 0 and: [t5 height > 0]) ifFalse: [^ false]. t6 _ Form extent: t5 extent depth: 2. t7 _ t6 deepCopy. t9 _ self visibility. self visibility: 100. t1 drawOn: ((FormCanvas on: t6) copyOffset: t5 topLeft negated). t1 visibility: t9. t9 _ t3 visibility. t3 visibility: 100. t3 drawOn: ((FormCanvas on: t7) copyOffset: t5 topLeft negated). t3 visibility: t9. t8 _ Bitmap new: 4 withAll: 1. t8 at: 1 put: 0. t6 copyBits: t6 boundingBox from: t6 at: 0 @ 0 colorMap: t8. t7 copyBits: t7 boundingBox from: t7 at: 0 @ 0 colorMap: t8. t7 displayOn: t6 at: 0 @ 0 rule: Form and. ^ (t6 tallyPixelValues at: 1) < (t6 width * t6 height)
What this block does:
Reports whether two sprites (or the mouse-pointer) are touching. Note: does not work if mouse and edge are entered.
Shared by Pecola1
Blockspec:
('open project with the id of %n' #- #openProjectId:)
Code:
openProjectId: t1
Cursor wait showWhile: [ScratchPlugin primOpenURL: 'http://scratch.mit.edu/api/getproject/' , t1]
What this block does:
Opens a web browser with the project of the ID that is entered.
Shared by Pecola1
Blockspec:
('password for %s is %s ?' #b #username:password:)
Code:
username: t1 password: t2
(HTTPSocket httpGet: 'contentshttp://scratch.mit.edu/api/authenticateuser?username=' , t1 , '&password=' , t2) contents = 'false' ifTrue: [^false].
^true
What this block does:
Reports whether the password for the username that is inserted is the right password. Useful for making a project which requires you have a Scratch account.
Shared by Hardmath123
Blockspec:
('ask %s' #r #askReport: 'What is your name?')
Code:
askReport: t1
^ StringDialog ask: t1
What this block does:
Asks a question in a dialog box and reports the answer.
Shared by Hardmath123
Blockspec:
('warn %s' #- #warn: 'Invalid input')
Code:
warn: t1
DialogBoxMorph warn: t1
What this block does:
Pops up a dialog with the text specified.
Shared by jsombla
Blockspec:
('if online then stop' #- #ifOnlineThenStop)
Code:
ifOnlineThenStop
| t1 t2 t3 |
t1_t2
What this block does:
Stops the script if online; it becomes an obsolete block.
Shared by jsombla
Blockspec:
('confirm %s' #b #confirm:)
Code:
No code needed
What this block does:
Asks the content. Choosing "yes" will report true, while "no" reports false.
Shared by jsombla
Blockspec:
('alert %s' #- #inform:)
Code:
No code needed
What this block does:
Alerts the user in a dialog.
Shared by TuragaTreeko, improved by Scimonster
Blockspec:
('rename me as %s' #- #rename: 'Sprite1')
Code:
rename: t1
self objName: t1
What this block does:
Renames the sprite.
Shared by TuragaTreeko
Blockspec:
('my name' #r #name)
Code:
name
^objName
What this block does:
Reports the sprite's name.
Shared by Greenatic
Blockspec:
('max x' #r #MaxX)
Code:
MaxX
^ self xpos + (0.5 * self width)
What this block does:
Reports the right end of the rectangle the sprite is in.
Shared by Greenatic
Blockspec:
('min x' #r #MinX)
Code:
MinX
^ self xpos - (0.5 * self width)
What this block does:
Reports the left end of the rectangle the sprite is in.
Shared by Greenatic
Blockspec:
('max y' #r #MaxY)
Code:
MaxX
^ self ypos + (0.5 * self height)
What this block does:
Reports the top end of the rectangle the sprite is in.
Shared by Greenatic
Blockspec:
('min y' #r #MinY)
Code:
MinY
^ self ypos - (0.5 * self height)
What this block does:
Reports the bottom end of the rectangle the sprite is in.
Shared by Greenatic, improved by Baderous
Blockspec:
('font %s exists?' #b #FontExists:)
Code:
FontExists: t1
| t2 |
t2 _ UnicodePlugin getFontList collect: [:f | f asUTF8].
^ t2 includes: t1
What this block does:
Checks if you have a specified font.
Shared by Greenatic
Blockspec:
('font #%n' #r #FontNumber:)
Code:
FontNumber: t1
| t2 t3 |
t1 isInf ifTrue: [^ nil].
t1 isNaN ifTrue: [^ nil].
t1 = t1 rounded ifFalse: [^ nil].
t1 < 1 ifTrue: [^ nil].
t2 _ UnicodePlugin getFontList.
t2 size < t1 ifTrue: [^ nil].
t3 _ 1.
t2 do:
[:t4 |
t3 = t1 ifTrue: [^ t4].
t3 _ t3 + 1]
^ Back to Scratch Blocks
^ Back to Contents
█ █ █ █ █ █ █ █
Last edited by YourLocalBlockLib (2011-12-17 14:54:04)
Offline
Sound
Shared by PlayWithFire
blockspec:
('import sound' #- #importSound)
no code needed
What this block does:
This block allows you to import a sound.
Shared by Sparks
blockspec:
('record sound' #- #recordSound)
no code needed
What it does:
Opens the sound recording window and lets you record a sound.
Shared by Pecola1
blockspec:
('length of %S' #r #lengthOfSound:)
Code:
lengthOfSound: t1 | t2 | t2 _ self soundNamed: t1 ifAbsent: [^ 0]. ^ t2 totalSeconds
What this block does:
Reports the amount of seconds it would take to play the sound in the insert.
Shared by Pecola1
blockspec:
('play from %n to %n secs of %S' #- #playFrom:to:ofSound:)
Code:
playFrom: t1 to: t2 ofSound: t3 | t4 | t4 _ self soundNamed: t3 ifAbsent: [^ self]. t4 playFrom: t1 to: t2
What this block does:
Plays a sound from the first insert to the second insert. Note: It does not wait for the sound to end for it to change to another block.
Shared by meew0
blockspec:
('beep' #- #beep)
Code:
no code needed
Shared by Greenatic
Blockspec:
('number of sounds' #r #SoundAmount)
Code:
SoundAmount
| t1 |
t1 _ 0.
media do: [:t2 | t2 isSound ifTrue: [t1 _ t1 + 1]].
^ t1
What it does:
Reports the number of sounds the sprite/stage has (not the total for the whole project).
^ Back to Scratch Blocks
^ Back to Contents
█ █ █ █ █ █ █ █
Last edited by YourLocalBlockLib (2011-12-17 14:58:26)
Offline
Operators
Shared by Zorket.
Blockspec:
('report %s' #r #report: 'hello')
Code:
report: t1
^ t1
What it does:
Reports it's contents. Useful for putting text in areas where it normally can't go. (Such as the [go to %m] block.
Shared by Zorket, optimised by nXIII
Blockspec:
('if %b then %s else %s' #r #if:then:else:)
Code:
if: t1 then: t2 else: t3
t1 ifTrue: [^ t2].
^ t3
What it does:
Reports the first string argument if the boolean is true, the second if it's false.
Shared by Zorket
Blockspec
('if %b then %b else %b' #b #if:then:else:)
Code:
if: t1 then: t2 else: t3
t1 ifTrue: [^ t2].
^ t3
What it does
Reports the truth of the first or second boolean argument depending on the truth of the first.
Shared by Zorket
Blockspec
('true' #b #reportTrue)
Code:
reportTrue
^ true
What it does
Reports true.
Shared by Zorket
Blockspec
('false' #b #reportFalse)
Code:
reportFalse
^ false
What it does
Reports false.
Shared by Zorket
Blockspec
('%T %s' #r #do:to:)
do: t1 to: t2 t1 = 'reverse' ifTrue: [^ t2 reversed]. t1 = 'shuffle' ifTrue: [^ t2 shuffled]. t1 = 'uppercase' ifTrue: [^ t2 asUppercase]. t1 = 'lowercase' ifTrue: [^ t2 asLowercase]. t1 = 'report' ifTrue: [^ t2].
Scratch-Blocks> CommandBlockMorph> private> uncoloredArgMorphFor: add a strip:
$T = t2 ifTrue: [^ ChoiceOrExpressionArgMorph new getOptionsSelector: #mixingNames; choice: 'reverse'].
Scratch objects> scriptableScratchMorph> otherOps:
mixingNames
^ #('lowercase' 'uppercase' 'reverse' 'shuffle' 'report' )
What this block does:
Does the operation on the specified string.
Shared by poemon1, based on the above block
Blockspec:
('%s %s' #r #do:to: 'shuffle' 'thing')
Code:
Same as above block.
Shared by Hardmath123.
Blockspec:
('%b' #r #booleanString:)
Code:
booleanString: t1
^ t1
What it does:
Allows you to drop booleans into reporter spaces!
Shared by Hardmath123.
Blockspec:
('%n ^ %n' #r #x:expy: 2 2)
Code:
x: t1 expy: t2
^ t1 raisedTo: t2
What it does:
Reports n1 to the power of n2.
Shared by Pecola1.
Blockspec:
('ascii for %s' #r #asciiCodeOf:)
Code:
asciiCodeOf: aString
| str |
str _ aString asMacRoman.
str size = 1 ifFalse: [^ 0].
^ str first asciiValue
What it does:
Reports the ASCII code for an entered character.
Shared by Pecola1.
Blockspec:
('ascii %n as character' #r #asciiLetter:)
Code:
asciiLetter: anInteger
| code |
code _ anInteger asNumberNoError.
^ String with: (Character value: code)
What it does:
Reports character the entered ASCII code stands for.
Shared by Hardmath123, improved by Baderous
Blockspec:
('%G' #r #getConstant:)
Code:
getConstant: t1
t1 = 'pi' ifTrue: [^ float pi].
t1 = 'phi' ifTrue: [^ float phi].
t1 = 'e' ifTrue: [^ float e].
t1 = 'sqrt 2' ifTrue: [^ 2 sqrt].
^ self error
Scratch-Objects»ScriptableScratchMorph»sensing
constants
^ #('pi' 'phi' 'e' 'sqrt 2' )
Scratch-Blocks»CommandBlockMorph»-- all --»uncoloredArgMorphFor: add a line:
$G = t2 ifTrue: [^ ChoiceOrExpressionArgMorph new getOptionsSelector: #constants;
choice: 'pi'].
What it does:
Reports the selected constant.
Shared by Hardmath123.
Blockspec:
('%b=%b' #b #a:equalsB:)
Code:
a: t1 equalsB: t2
t1 = t2 ifTrue [^true].
^false.
What it does:
Reports whether or not the two booleans are equal.
Shared by ESN.
Click here for the block code.
What it does:
Reports a fraction of a number from a dropdown.
Shared by Zorket.
Blockspec
('letter %n of the alphabet' #r #letter:)
Code:
letter: t1 t1 = 1 ifTrue: [^ 'a']. t1 = 2 ifTrue: [^ 'b']. t1 = 3 ifTrue: [^ 'c']. t1 = 4 ifTrue: [^ 'd']. t1 = 5 ifTrue: [^ 'e']. t1 = 6 ifTrue: [^ 'f']. t1 = 7 ifTrue: [^ 'g']. t1 = 8 ifTrue: [^ 'h']. t1 = 9 ifTrue: [^ 'i']. t1 = 10 ifTrue: [^ 'j']. t1 = 11 ifTrue: [^ 'k']. t1 = 12 ifTrue: [^ 'l']. t1 = 13 ifTrue: [^ 'm']. t1 = 14 ifTrue: [^ 'n']. t1 = 15 ifTrue: [^ 'o']. t1 = 16 ifTrue: [^ 'p']. t1 = 17 ifTrue: [^ 'q']. t1 = 18 ifTrue: [^ 'r']. t1 = 19 ifTrue: [^ 's']. t1 = 20 ifTrue: [^ 't']. t1 = 21 ifTrue: [^ 'u']. t1 = 22 ifTrue: [^ 'v']. t1 = 23 ifTrue: [^ 'w']. t1 = 24 ifTrue: [^ 'x']. t1 = 25 ifTrue: [^ 'y']. t1 = 26 ifTrue: [^ 'z']. ^ self error
What it does:
Gives you the letter from the alphabet corresponding to the number you enter.
Shared by Pecola1.
Blockspec:
('report %b or %b randomly' #b #booleanRandom:Or:)
Code:
booleanRandom: t1 Or: t2
| t3 |
t3 _ self randomFrom: 0 to: 1.
t3 = 1 ifTrue: [^ t1].
^ t2
What it does:
Reports either of the booleans randomly.
Shared by Zorket.
Blockspec:
('%n %s %n' #r #workOut:with:to:)
Code:
workOut: t1 with: t2 to: t3
t2 = '+' ifTrue: [^ t1 + t3].
t2 = '-' ifTrue: [^ t1 - t3].
t2 = '*' ifTrue: [^ t1 * t3].
t2 = '/' ifTrue: [^t1 / t3].
^ 'Error!'
What it does:
Designed to replaces the +, -, * and / reporter blocks.
Shared by Pecola1.
Blockspec:
('%s as boolean' #b #stringAsBoolean:)
Code:
stringAsBoolean: t1
| t2 |
t2 _ t1 asString.
(t2 = '0'
or: [t2 = '' or: [t2 = 'false']])
ifTrue: [^ false].
^ true
What it does:
Reports false if the string is blank, 0, or "false," otherwise reports true.
Shared by Hardmath123.
Blockspec:
('greater of %n and %n' #r #greater:and:)
Code:
greater: t1 and: t2
t1 > t2 ifTrue: [^ t1].
^ t2
What it does:
Reports the greater of the two values.
Shared by Hardmath123.
Blockspec:
('lesser of %n and %n' #r #greater:and:)
Code:
lesser: t1 and: t2
t1 < t2 ifTrue: [^ t1].
^ t2
What it does:
Reports the lesser of the two values.
Shared by Hardmath123
Blockspec:
('%n root of %n' #r #root:of: 2 64)
Code:
root: t1 of: t2
t2 > 0 ifTrue: [^ t2 raisedTo: 1 / t1].
^ t2 * -1 raisedTo: 1 / t1
What it does:
Reports the root of a number; i.e. the inserts 2 and 64 would be 8, 8 is the square root of 64.
Shared by hello12345678910
Blockspec:
('-%n' #r #negation:)
Code:
negation: t1
^ t1 * -1
What it does:
Reports the negative of a number.
Shared by Hardmath123
Blockspec:
('%n is divisible by %n' #b #test:div: 11 5)
Code:
test: t1 div: t2
^ t1 / t2 = (t1 / t2) rounded
What it does:
Does a divisibility test.
Shared by Hardmath123
Blockspec:
('fractional part of %n' #r #fractional: 3.14)
Code:
fractional: t1
^ t1 - (t1 - 0.5) rounded
What it does:
Reports the digits after the decimal point.
Shared by Hardmath123
These blocks all rely on one-another's code so you need to install them all at once.
Blockspecs:
('Get the first %n letters of %s' #r #getNum:string: 3 #'scratch')
('Get the last %n letters of %s' #r #getLastNum:string: 3 #'scratch')
('Get letters %n to %n of %s' #r #getLetter:to:of: 1 4 #'scratch')
('%s %n times' #r #string:times: 'scratch ' '2')
Codes:
getNum: t1 string: t2
| t3 t4 |
t1 = 1 ifTrue: [^ self letter: 1 of: t2].
t3 _ self getNum: t1 - 1 string: t2.
t4 _ self letter: t1 of: t2.
^ t3, t4
getLastNum: t1 string: t2
^ (self getNum: t1 string: t2 reversed) reversed
getLetter: t1 to: t2 of: t3
| t4 t5 |
t4 _ self getNum: t3 size + 1 - t2 string: t3.
t5 _ self getLastNum: t4 size + 1 - t1 string: t4.
^ t5
string: t1 times: t2
t2 = 1 ifTrue: [^ t1].
^ (self string: t1 times: t2 - 1)
, t1
Shared by jslomba and improved by Scimonster
This block requires the ([fraction] of ( ) ) block above by ESN.
Blockspec:
('%z as decimal' #r #decimalOf:)
Code:
decimalOf: t1
'1/2' = t1 ifTrue: [^ 1/2].
'1/3' = t1 ifTrue: [^ 1/3].
'1/4' = t1 ifTrue: [^ 1/4].
'1/5' = t1 ifTrue: [^ 1/5].
'1/6' = t1 ifTrue: [^ 1/6].
'1/7' = t1 ifTrue: [^ 1/7].
'1/8' = t1 ifTrue: [^ 1/8].
'1/9' = t1 ifTrue: [^ 1/9].
'1/10' = t1 ifTrue: [^ 1/10]
Shared by Scimonster
Blockspec:
('%s is %s' #b #case:sensitive:)
Code:
case: t1 sensitive: t2
t1 = t2 ifTrue: [^ true].
^ false
What this block does:
Is a case-sensitive <[] = []> block.
Shared by Scimonster
Blockspec:
('%s is lowercase' #b #isLowercase:)
Code:
isLowercase: t1
t1 = '' ifTrue: [^ false].
t1 = t1 asLowercase ifTrue: [^ true].
^ false
What this block does:
Reports whether or not the inputted text is lowercase.
Shared by Scimonster
Blockspec:
('%s is uppercase' #b #isUppercase:)
Code:
isUppercase: t1
t1 = '' ifTrue: [^ false].
t1 = t1 asUppercase ifTrue: [^ true].
^ false
What this block does:
Reports whether or not the inputted text is uppercase.
Shared by Scimonster
Blockspec:
('%s is uppercase' #b #isMixed:)
Code:
isMixed: t1
t1 = t1 asLowercase ifTrue: [^ false].
t1 = t1 asUppercase ifTrue: [^ false].
^ true
What this block does:
Reports whether or not the inputted text is mixed uppercase and lowercase.
Shared by LS97
Blockspec:
('%s contains %s' #b #if:contains:)
Code:
if: t1 contains: t2
(t1 findString: t2)
> 0 ifTrue: [^ true].
^ false
What this block does:
Reports whether a given string contains another.
Shared by Hardmath123
Blockspec:
('Position of first instance of %s in %s' #r #index:of: 'i' 'Mississippi')
Code:
index: t2 of: t1
^t1 findString: t2
What this block does:
Finds the first instance of a string in another.
Shared by Hardmath123
Blockspec:
('%s is a palindrome?' #b #palindrome:)
Code:
palindrome: i1
"Made with Scramble by Hardmath123"
| t1 |
t1_i1.
t1_ t1 asString reversed.
t1 = i1 ifTrue: [^ true].
^ false
What this block does:
Reports whether or not the block is a palindrome.
Shared by jsombla, improved by Scimonster
Blockspec:
('is %s nil?' #b #checkNil:)
Code:
checkNil: str
^ str isNil
What this block does:
Checks if the content is nil.
Shared by Greenatic
Blockspec:
('random letter' #r #randomLetter)
Code:
randomLetter | t1 | t1 _ self randomFrom: 1 to: 26. t1 = 1 ifTrue: [^ 'a']. t1 = 2 ifTrue: [^ 'b']. t1 = 3 ifTrue: [^ 'c']. t1 = 4 ifTrue: [^ 'd']. t1 = 5 ifTrue: [^ 'e']. t1 = 6 ifTrue: [^ 'f']. t1 = 7 ifTrue: [^ 'g']. t1 = 8 ifTrue: [^ 'h']. t1 = 9 ifTrue: [^ 'i']. t1 = 10 ifTrue: [^ 'j']. t1 = 11 ifTrue: [^ 'k']. t1 = 12 ifTrue: [^ 'l']. t1 = 13 ifTrue: [^ 'm']. t1 = 14 ifTrue: [^ 'n']. t1 = 15 ifTrue: [^ 'o']. t1 = 16 ifTrue: [^ 'p']. t1 = 17 ifTrue: [^ 'q']. t1 = 18 ifTrue: [^ 'r']. t1 = 19 ifTrue: [^ 's']. t1 = 20 ifTrue: [^ 't']. t1 = 21 ifTrue: [^ 'u']. t1 = 22 ifTrue: [^ 'v']. t1 = 23 ifTrue: [^ 'w']. t1 = 24 ifTrue: [^ 'x']. t1 = 25 ifTrue: [^ 'y']. t1 = 26 ifTrue: [^ 'z']
Shared by Greenatic
Blockspec:
('factorial of %n' #r #Factorial:)
Code:
Factorial: t1
| answer t1store |
t1 isInf ifTrue:[^0].
t1 isNaN ifTrue:[^0].
answer _ 1.
t1store _ t1.
t1 = 0 ifTrue: [^ 1].
t1 < 0 ifTrue: [^ 0].
t1 isInf ifTrue: [^ 0].
t1 isNaN ifTrue: [^ 0].
[t1store > 1]
whileTrue:
[answer _ answer * t1store.
t1store _ t1store - 1].
^ answer
What this block does:
Reports the factorial of a number.
Shared by Greenatic, improved by Scimonster
Blockspec:
('%n is an integer?' #b #isInteger:)
Code:
isInteger: t1
^ t1 = t1 rounded
What this block does:
Reports whether the number is an integer.
Shared by Greenatic
Blockspec:
('%n is a Fibonacci number?' #b #IsFibonacci:)
Code:
IsFibonacci: t1
| fib1 fib2 oldfib2 fib3 oldfib3 |
t1 isInf ifTrue:[^false].
t1 isNaN ifTrue:[^false].
t1 < 0 ifTrue: [^ false].
t1 = 0 ifTrue: [^ true].
t1 = 1 ifTrue: [^ true].
fib1 _ 0.
fib2 _ 1.
oldfib2 _ fib2.
fib3 _ fib1 + fib2.
oldfib3 _ fib3.
[t1 > fib3]
whileTrue:
[fib3 _ fib1 + fib2.
fib2 _ oldfib3.
fib1 _ oldfib2.
oldfib3 _ fib3.
oldfib2 _ fib2].
t1 = fib3 ifTrue: [^ true].
t1 = fib3 ifFalse: [^ false]
What this block does:
Reports if the block is a Fibonacci number.
Shared by Greenatic
Blockspec:
('%n is prime?' #b #IsPrime:)
Code:
IsPrime: t1
| divisor factor |
t1 isInf ifTrue: [^ false].
t1 isNaN ifTrue: [^ false].
t1 < 1 ifTrue: [^ false].
t1 = 1 ifTrue: [^ false].
t1 = t1 rounded ifFalse:[^false].
divisor _ 2.
[divisor > (0.5 * t1)]
whileFalse:
[factor _ t1 / divisor.
factor = factor rounded ifTrue: [^false].
divisor _ divisor + 1].
^ true
What this block does:
Reports if the number is prime.
Shared by Lots of People
Blockspec:
('error' #r #error)
Code:
No code needed
What this block does:
Reports an error.
Shared by Greenatic
Click the image for the codes. (13 blocks)
What these blocks do:
Let's you do arithmetic in any base from -36 to 36 (except for base -1 and base 0) and change between any of those bases.
^ Back to Scratch Blocks
^ Back to Contents
█ █ █ █ █ █ █ █
Last edited by YourLocalBlockLib (2011-09-09 04:54:37)
Offline
Pen
Shared by Jonathanpb
blockspec:
('pen size' #r #penSize)
no code needed
What it does:
Reports the current pen size.
Shared by zorket
blockspec:
('pen down?' #b #penDown)
no code needed
What it does:
Reports whether the pen for that sprite is down or not.
Shared by Jwosty
blockspec:
('pen shade' #r #penShade)
code:
penShade
^ penShade
What it does:
Reports the shade of the sprite's pen.
Shared by Jwosty
blockspec:
('pen color' #r #penHue)
code
penHue
^ penHue
What it does:
Reports the pen color.
Shared by Hardmath123 and made with Scramble
Blockspec:
('switch the up/down value of the pen' #- #switchPenValue)
Code:
switchPenValue
"Made using Scramble by Hardmath123"
| t1 |
t1 _ self penDown.
t1 ifTrue: [self putPenUp.].
t1 ifFalse: [self putPenDown.].
What this block does:
If the pen is down, put it up, and if it is up, put it down.
Shared by Hardmath123
Blockspec:
('Stamp me at x: %n y: %n ' #- #stampAt:stampAt:)
Code:
stampAt: i1 stampAt: i2
"Made with Scramble by Hardmath123"
| t2 t1 |
t1_ self xpos.
t2_ self ypos.
self gotoX: i1 y:i2.
self stampCostume.
self gotoX: t1 y:t2.
What this block sprites:
Stamps the sprite at the specified position.
^ Back to Scratch Blocks
^ Back to Contents
█ █ █ █ █ █ █ █
Last edited by YourLocalBlockLib (2011-07-20 14:59:23)
Offline
Variables
Shared by Hardmath123
Blockspec:
('make new variable' #- #addGlobalVariable)
Code:
no code needed
What it does:
Creates a new variable!
Shared by Pecola1
Blockspec:
('move %v to x: %n y: %n' #- #positionVar:atX:y: '' 0 0)
Code:
positionVar: t1 atX: t2 y: t3 | t4 t5 t6 t7 t8 t9 | (self varNames includes: t1) ifFalse: [^ self]. t4 _ self ownerThatIsA: ScratchFrameMorph. t4 ifNil: [(t5 _ self ownerThatIsA: OffscreenWorldMorph) ifNil: [^ self]. t4 _ t5 frame]. t6 _ VariableBlockMorph new commandSpec: t1; receiver: self blockReceiver. (t5 _ t4 watcherForBlock: t6) ifNil: [^ self]. t7 _ t2. t7 isNaN ifTrue: [t7 _ 0]. t7 > 240 ifTrue: [t7 _ 240]. t7 < (-240 - t5 extent x) ifTrue: [t7 _ -240 - t5 extent x]. t8 _ t3. t8 isNaN ifTrue: [t8 _ 0]. t8 < -180 ifTrue: [t8 _ -180]. t8 > (180 + t5 extent y) ifTrue: [t8 _ 180 + t5 extent y]. t9 _ t7 @ t8 negated. t5 position: ScratchOrigin + t9
Code 2:
moveVar: t1 toX: t2 y: t3
| t4 |
self
positionVar: t1
atX: t2
y: t3.
t4 _ self ownerThatIsA: ScratchStageMorph.
t4 ~= self
ifTrue: [t4
positionVar: t1
atX: t2
y: t3]
What it does:
Changes the position of a variable watcher on the Stage.
Shared by Hardmath123
Blockspec:
('NewList' #- #addGlobalList)
Code:
No code needed.
What it does:
Opens the new list dialog.
Shared by Hardmath123
Blockspec:
('Add local list named %s' #- #createListNamed:)
Code:
No code needed.
What it does:
Creates a local list (for this sprite only) named the specified name.
Shared by Hardmath123
Blockspec:
('Add global list named %s' #- #GLN: #MyList)
Code:
GLN: t2
| t1 |
(t1 _ self ownerThatIsA: ScratchFrameMorph) ifNil: [^ self beep].
t2 size = 0 ifTrue: [^ self].
t1 workPane createListNamed: t2.
t1 viewerPane categoryChanged: 'variables'
What it does:
Creates a global list (for all sprites) named the specified name.
Shared by Hardmath123
Blockspec:
('set the list blocks color to %c' #- #setListBlockColorSelf:)
Code: (place under sensing ops)
setListBlockColorSelf: t1
ListBlockColor _ t1
What it does:
Changes the color for the list blocks.
Shared by Greenatic, improved by LS97 and Baderous
Blockspec:
('import fonts to list %L' #- #FontstoList: 'list')
Code:
FontstoList: t1
| t2 |
t2 _ UnicodePlugin getFontList.
t2 do: [:t3 | self append: t3 toList: t1]
Scratch-Objects > Scriptable Scratch Morph > blocks > defaultArgsFor:
Add right before the last line ( ^ t2 ):
#FontstoList: = t4
ifTrue: [t2 size >= 1 ifTrue: [t2 at: 1 put: self defaultListName]].
What it does:
Adds all the fonts on your computer to a list.
Shared by Greenatic
Blockspec:
('%Y of %L' #r #Math:List: 'mean' 'list')
Code:
Math: t1 List: t2 | max min line sum t3 t4 a | t1 = 'maximum' ifTrue:[ (self lineCountOfList: t2) asNumberNoError = 0 ifTrue: [^ 0]. (self lineCountOfList: t2) = 1 ifTrue: [^ (self getLine: 1 ofList: t2) asNumberNoError]. max _ (self getLine: 1 ofList: t2) asNumberNoError. line _ 2. (self lineCountOfList: t2) asNumberNoError - 1 timesRepeat: [(self getLine: line ofList: t2) asNumberNoError > max ifTrue: [max _ (self getLine: line ofList: t2) asNumberNoError]. line _ line + 1]. ^ max]. t1 = 'minimum' ifTrue:[ (self lineCountOfList: t2) asNumberNoError = 0 ifTrue: [^ 0]. (self lineCountOfList: t2) = 1 ifTrue: [^ (self getLine: 1 ofList: t2) asNumberNoError]. min _ (self getLine: 1 ofList: t2) asNumberNoError. line _ 2. (self lineCountOfList: t2) asNumberNoError - 1 timesRepeat: [(self getLine: line ofList: t2) asNumberNoError < min ifTrue: [min _ (self getLine: line ofList: t2) asNumberNoError]. line _ line + 1]. ^ min]. t1 = 'mean' ifTrue:[ (self lineCountOfList: t2) = 0 ifTrue: [^ 0]. (self lineCountOfList: t2) = 1 ifTrue: [^ self getLine: 1 ofList: t2]. (self lineCountOfList: t2) = 0 ifTrue: [^ 0]. (self lineCountOfList: t2) = 1 ifTrue: [^ (self getLine: 1 ofList: t2) asNumberNoError]. t3 _ 2. sum _ (self getLine: 1 ofList: t2) asNumberNoError. (self lineCountOfList: t2) - 1 timesRepeat: [sum _ sum + (self getLine: t3 ofList: t2) asNumberNoError. t3 _ t3 + 1]. ^ sum / (self lineCountOfList: t2)]. t1 = 'range' ifTrue:[ (self lineCountOfList: t2) = 0 ifTrue: [^ 0]. (self lineCountOfList: t2) = 1 ifTrue: [^ 0]. (self lineCountOfList: t2) asNumberNoError = 0 ifTrue: [^ 0]. (self lineCountOfList: t2) = 1 ifTrue: [^ (self getLine: 1 ofList: t2) asNumberNoError]. max _ (self getLine: 1 ofList: t2) asNumberNoError. line _ 2. (self lineCountOfList: t2) asNumberNoError - 1 timesRepeat: [(self getLine: line ofList: t2) asNumberNoError > max ifTrue: [max _ (self getLine: line ofList: t2) asNumberNoError]. line _ line + 1]. (self lineCountOfList: t2) asNumberNoError = 0 ifTrue: [^ 0]. (self lineCountOfList: t2) = 1 ifTrue: [^ (self getLine: 1 ofList: t2) asNumberNoError]. min _ (self getLine: 1 ofList: t2) asNumberNoError. line _ 2. (self lineCountOfList: t2) asNumberNoError - 1 timesRepeat: [(self getLine: line ofList: t2) asNumberNoError < min ifTrue: [min _ (self getLine: line ofList: t2) asNumberNoError]. line _ line + 1]. ^ max - min]. t1 = 'median' ifTrue:[ (self lineCountOfList: t2) = 0 ifTrue: [^ 0]. t3 _ #() asOrderedCollection. t4 _ 1. (self lineCountOfList: t2) timesRepeat: [t3 add: (self getLine: t4 ofList: t2) asNumberNoError. t4 _ t4 + 1]. t3 _ t3 asArray sort. t3 _ t3 asOrderedCollection. [t3 size > 2] whileTrue: [t3 removeAt: 1. t3 removeAt: t3 size]. t3 size = 1 ifTrue: [^ t3 at: 1]. ^ (t3 at: 1) + (t3 at: 2) / 2]. t1 = 'sum' ifTrue:[ (self lineCountOfList: t2) = 0 ifTrue: [^ 0]. (self lineCountOfList: t2) = 1 ifTrue: [^ (self getLine: 1 ofList: t2) asNumberNoError]. t3 _ 2. a _ (self getLine: 1 ofList: t2) asNumberNoError. (self lineCountOfList: t2) - 1 timesRepeat: [a _ a + (self getLine: t3 ofList: t2) asNumberNoError. t3 _ t3 + 1]. ^ a]. t1 = 'difference' ifTrue:[ (self lineCountOfList: t2) = 0 ifTrue: [^ 0]. (self lineCountOfList: t2) = 1 ifTrue: [^ (self getLine: 1 ofList: t2) asNumberNoError]. t3 _ 2. a _ (self getLine: 1 ofList: t2) asNumberNoError. (self lineCountOfList: t2) - 1 timesRepeat: [a _ a - (self getLine: t3 ofList: t2) asNumberNoError. t3 _ t3 + 1]. ^ a]. t1 = 'product' ifTrue:[ (self lineCountOfList: t2) = 0 ifTrue: [^ 0]. (self lineCountOfList: t2) = 1 ifTrue: [^ (self getLine: 1 ofList: t2) asNumberNoError]. t3 _ 2. a _ (self getLine: 1 ofList: t2) asNumberNoError. (self lineCountOfList: t2) - 1 timesRepeat: [a _ a * (self getLine: t3 ofList: t2) asNumberNoError. t3 _ t3 + 1]. ^ a]. t1 = 'quotient' ifTrue:[ (self lineCountOfList: t2) = 0 ifTrue: [^ 0]. (self lineCountOfList: t2) = 1 ifTrue: [^ (self getLine: 1 ofList: t2) asNumberNoError]. t3 _ 2. a _ (self getLine: 1 ofList: t2) asNumberNoError. (self lineCountOfList: t2) - 1 timesRepeat: [a _ a / (self getLine: t3 ofList: t2) asNumberNoError. t3 _ t3 + 1]. ^ a].
ScriptableScratchMorph > list ops
listMath
^ #('mean' 'median' #- 'maximum' 'minimum' 'range' #- 'sum' 'difference' 'product' 'quotient' )
Scratch-Blocks> CommandBlockMorph> private> uncoloredArgMorphFor: add:
$Y = t2 ifTrue: [^ ChoiceOrExpressionArgMorph new getOptionsSelector: #listMath;
choice: 'mean'].
Scratch-Objects > Scriptable Scratch Morph > blocks > defaultArgsFor:
Add right before the last line ( ^ t2 ):
#Math:List: = t4
ifTrue: [t2 size >= 2 ifTrue: [t2 at: 1 put: (t2 at: 1) localized.
t2 at: 2 put: self defaultListName]].
What it does:
Performs operations on a list and reports the result.
Shared by Greenatic
Blockspec:
('add items %n to %n of %L to %L' #- #First:Last:From:To: '1' '3' 'list' 'list')
Code:
First: t1 Last: t2 From: t3 To: t4 | t5 t6 | t1 isInf ifTrue: [^ self]. t1 isNaN ifTrue: [^ self]. t1 isNil ifTrue: [^ self]. t2 isInf ifTrue: [^ self]. t2 isNaN ifTrue: [^ self]. t2 isNil ifTrue: [^ self]. t1 = t1 rounded ifFalse: [^ self]. t2 = t2 rounded ifFalse: [^ self]. t1 < 1 ifTrue: [^ self]. t2 < 1 ifTrue: [^ self]. t1 > (self lineCountOfList: t3) ifTrue: [^ self]. t2 > (self lineCountOfList: t3) ifTrue: [^ self]. t5 _ t1. (t2 - t1) abs + 1 timesRepeat: [self append: (self getLine: t5 ofList: t3) toList: t4. t6 _ false. t2 > t1 ifTrue: [t5 _ t5 + 1. t6 _ true]. t6 = false ifTrue: [t5 _ t5 - 1]]
Scratch-Objects > ScriptableScratchMorph > blocks > defaultArgsFor:
Add right before the last line ( ^ t2 ):
#First:Last:From:To: = t4
ifTrue: [t2 size >= 4
ifTrue:
[t2 at: 1 put: (t2 at: 1) localized.
t2 at: 2 put: (t2 at: 2) localized.
t2 at: 3 put: self defaultListName.
t2 at: 4 put: self defaultListName]].
What it does:
Adds some items from one list to another.
Shared by Greenatic
Blockspec:
('sort items of %L by numerical value' #- #NumberSort: 'list')
Code:
NumberSort: t1 | t2 t3 t4 t5 t6 | t2 _ #() asOrderedCollection. t3 _ #() asOrderedCollection. t4 _ #() asOrderedCollection. t6 _ #() asOrderedCollection. t5 _ 1. (self lineCountOfList: t1) timesRepeat: [t2 add: (self getLine: t5 ofList: t1). t5 _ t5 + 1]. t2 do: [:t7 | t3 add: t7 asNumberNoError. t7 asNumberNoError = 0 ifTrue: [t4 add: t7]]. t3 _ t3 asArray sort. t3 _ t3 asOrderedCollection. t5 _ 1. t3 do: [:t8 | t8 = 0 ifFalse: [t6 add: t8]. t8 = 0 ifTrue: [t6 add: (t4 at: t5). t5 _ t5 + 1]]. self deleteLine: 'all' ofList: t1. t6 do: [:t9 | self append: t9 toList: t1]
Scratch-Objects > ScriptableScratchMorph > blocks > defaultArgsFor:
Add right before the last line ( ^ t2 ):
#NumberSort: = t4
ifTrue: [t2 size >= 1 ifTrue: [t2 at: 1 put: self defaultListName]].
What it does:
Interprets the items of a list as numbers and sorts them. (A string counts as 0).
Shared by Greenatic
Blockspec:
('sort items of %L by string value' #- #StringSort: 'list')
Code:
SringSort: t1 | t2 t3 | (self lineCountOfList: t1) = 0 ifTrue: [^ self]. (self lineCountOfList: t1) = 1 ifTrue: [^ self]. t2 _ #() asOrderedCollection. t3 _ 1. (self lineCountOfList: t1) timesRepeat: [t2 add: (self getLine: t3 ofList: t1). t3 _ t3 + 1]. t2 _ t2 asArray sort. self deleteLine: 'all' ofList: t1. t2 do: [:t4 | self append: t4 toList: t1]
Scratch-Objects > ScriptableScratchMorph > blocks > defaultArgsFor:
Add right before the last line ( ^ t2 ):
#StringSort: = t4
ifTrue: [t2 size >= 1 ifTrue: [t2 at: 1 put: self defaultListName]].
What it does:
Interprets the items of a list as strings and sorts them.
Shared by Greenatic
Blockspec:
('first index of %s in %L' #r #IndexOf:List: '' 'list')
Code:
IndexOf: t1 List: t2 | t3 | t3 _ 1. (self lineCountOfList: t2) timesRepeat: [(self getLine: t3 ofList: t2) = t1 ifTrue: [^ t3]. t3 _ t3 + 1]. ^ 0
Scratch-Objects > ScriptableScratchMorph > blocks > defaultArgsFor:
Add right before the last line ( ^ t2 ):
#IndexOf:List: = t4
ifTrue: [t2 size >= 2
ifTrue:
[t2 at: 1 put: (t2 at: 1) localized.
t2 at: 2 put: self defaultListName]].
What it does:
Reports the first index of the argument in the list, and reports 0 if the item is not in the list.
Shared by Greenatic
Blockspec:
('times %s appears in %L' #r #Times:List: '' 'list')
Code:
Times: t1 List: t2 | t3 t4 | t3 _ 1. t4 _ 0. (self lineCountOfList: t2) timesRepeat: [(self getLine: t3 ofList: t2) = t1 ifTrue: [t4 _ t4 + 1]. t3 _ t3 + 1]. ^ t4
Scratch-Objects > ScriptableScratchMorph > blocks > defaultArgsFor:
Add right before the last line ( ^ t2 ):
#Times:List: = t4
ifTrue: [t2 size >= 2
ifTrue:
[t2 at: 1 put: (t2 at: 1) localized.
t2 at: 2 put: self defaultListName]].
What it does:
Reports the number of times the argument is in the list.
Shared by Greenatic
Blockspec:
('mode(s) of %L, spacer %s' #r #ModeOf:Spacer: 'list' ',')
Code:
ModeOf: t1 Spacer: t2 | t3 t4 t5 t6 t7 | (self lineCountOfList: t1) = 0 ifTrue: [^ nil]. (self lineCountOfList: t1) = 1 ifTrue: [^ nil]. t3 _ #() asOrderedCollection. t4 _ #() asOrderedCollection. t5 _ 0. (self lineCountOfList: t1) timesRepeat: [t6 _ 1. t7 _ false. t5 _ t5 + 1. (t3 includes: (self getLine: t5 ofList: t1) asNumberNoError) ifFalse: [t3 add: (self getLine: t5 ofList: t1) asNumberNoError. t4 add: 1. t7 _ true]. t7 = false ifTrue: [[(t3 at: t6) = (self getLine: t5 ofList: t1) asNumberNoError] whileFalse: [t6 _ t6 + 1]. t4 _ t4 asArray. t4 at: t6 put: (t4 at: t6) + 1. t4 _ t4 asOrderedCollection]]. t5 _ 1. t6 _ 1. t4 size timesRepeat: [(t4 at: t5) > t6 ifTrue: [t6 _ t4 at: t5]. t5 _ t5 + 1]. t6 = 1 ifTrue: [^ nil]. t5 _ 1. t4 size timesRepeat: [t7 _ false. (t4 at: t5) < t6 ifTrue: [t3 removeAt: t5. t4 removeAt: t5. t7 _ true]. t7 = false ifTrue: [t5 _ t5 + 1]]. t3 size = 1 ifTrue: [^ t3 at: 1]. t5 _ 2. t3 _ t3 asArray sort. t3 _ t3 asOrderedCollection. t6 _ (t3 at: 1) asString. t3 size - 1 timesRepeat: [t6 _ t6 , t2. t6 _ t6 , (t3 at: t5) asString. t5 _ t5 + 1]. ^ t6
Scratch-Objects > ScriptableScratchMorph > blocks > defaultArgsFor:
Add right before the last line ( ^ t2 ):
#ModeOf:Spacer: = t4
ifTrue: [t2 size >= 2
ifTrue:
[t2 at: 1 put: self defaultListName.
t2 at: 2 put: (t2 at: 2) localized]].
What it does:
Reports the mode of the list. If there is more than one, it reports them as a single string with the modes separated by the spacer value.
^ Back to Scratch Blocks
^ Back to Contents
█ █ █ █ █ █ █ █
Last edited by YourLocalBlockLib (2011-12-17 14:53:13)
Offline
. Visit the BYOB site
How to add one of these blocks:
You need to download BYOB (Build Your Own Blocks) from this link.
How do I make a custom BYOB block?
How do I share a BYOB block?
To view all the downloadable BYOB blocks click here. (Thanks to meowmeow55 for this feature.)
Choose a block type to view, or scroll down this page to see more!
Motion
Control
Looks
Sensing
Sound
Operators
Pen
Variables
Other
home
Last edited by YourLocalBlockLib (2011-08-23 14:47:35)
Offline
Motion
Shared by Jonathanpb
Shared by PlayWithFire
Shared by SSBBM
Shared by Guinea_Pig_Girl
Shared by SSBBM, Credit to Kileymeister
Shared by Guinea_Pig_Girl.
Shared by owetre18.
Shared by meowmeow55.
Shared by Floppy_gunk
Shared by Floppy_gunk
Shared by GP1
Shared by Floppy_gunk
Shared by rdococ
Shared by SSBBM
Shared by Flashgocrazy
_____________________________
^ Back to BYOB Blocks
^ Back to Contents
█ █ █ █ █ █ █ █ █
Last edited by YourLocalBlockLib (2011-08-23 15:35:40)
Offline
Control
Shared by midnightleopard
(See also) Shared by midnightleopard
Shared by SSBBM (credit to zxz1661)
Shared by SSBBM
Shared by SSBBM
Shared by meowmeow55
Shared by SSBBM
Shared by SSBBM
Shared by ESN
Shared by Floppy_gunk
Shared by Floppy_gunk
Shared by Floppy_gunk
Shared by Floppy_gunk
Shared by MathWizz
Shared by Floppy_gunk
Shared by joefarebrother
Shared by owetre18
Shared by SSBBM
_____________________________
^ Back to BYOB Blocks
^ Back to Contents
█ █ █ █ █ █ █ █ █
Last edited by YourLocalBlockLib (2011-07-28 14:58:03)
Offline
Looks
Shared by Jonathanpb
Shared by Jonathanpb
Shared by Jonathanpb
Shared by PlayWithFire
Shared by PlayWithFire
Shared by SSBBM
Shared by SSBBM
Shared by SSBBM
Shared by SSBBM
Shared by owetre18
Shared by Matty3414
Shared by Flashgocrazy
_____________________________
^ Back to BYOB Blocks
^ Back to Contents
█ █ █ █ █ █ █ █ █
Last edited by YourLocalBlockLib (2011-08-30 12:16:54)
Offline
Sensing
Shared by PlayWithFire
Shared by PlayWithFire
Shared by SSBBM
Shared by SSBBM
Shared by SSBBM Note: Incomplete picture.
Shared by ScratchReallyROCKS
Shared by thecrazyguy and improved by Pecola1
Shared by subzerostig
Shared by subzerostig
Shared by Joefarebrother
_____________________________
^ Back to BYOB Blocks
^ Back to Contents
█ █ █ █ █ █ █ █ █
Last edited by YourLocalBlockLib (2011-08-31 20:15:25)
Offline
Offline
Operators
Non-Math Blocks
Shared by meowmeow55
Shared by meowmeow55 Note: unlike the normal equals boolean, this one is case sensitive!
Shared by rdococ
Shared by bbbeb
Shared by meowmeow55
Shared by Pecola1, Improved by SSBBM
Shared by Pecola1
Shared by Pecola1
Shared by Pecola1
Shared by Pecola1
Shared by SSBBM
Shared by SSBBM
Shared by SSBBM
Shared by Floppy_gunk
Shared by Scimonster
Shared by MathWizz
Shared by MathWizz
Shared by MathWizz
Shared by SSBBM, credit to TheSuccessor
Shared by roijac
Shared by Sidharth
Shared by Flashgocrazy, updated by Joefarebrother
Shared by Flashgocrazy, updated by Joefarebrother
Shared by joefarebrother
_____________________________
^ Back to BYOB Blocks
^ Back to Contents
█ █ █ █ █ █ █ █ █
Math Blocks
Shared by PlayWithFire
Shared by PlayWithFire, Improved by Floppy_gunk
Shared by meowmeow55
Shared by SSBBM
Shared by meowmeow55
Shared by meowmeow55
Shared by sid_the_great
Shared by subzerostig
Shared by subzerostig
Shared by SSBBM, Credit to meowmeow55
Shared by SSBBM
Shared by SSBBM, Improved by Scimonster
Shared by sid_the_great and Sparks
Shared by sid_the_great and Sparks
Shared by sid_the_great and Sparks
Shared by Beary605
Shared by Beary605
Shared by Beary605, Improved by Floppy_gunk
Shared by Beary605
Shared by Beary605
Shared by Floppy_gunk
Shared by Floppy_gunk
Shared by Floppy_gunk
Shared by Floppy_gunk
Shared by Floppy_gunk
Shared by Floppy_gunk
Shared by Spongelove, improved by Floppy_gunk
Shared by Spongelove, improved by Floppy_gunk
Shared by Scimonster
Shared by Floppy_Gunk
Shared by Floppy_Gunk
Shared by SSBBM, uses ()! block by Beary605
Shared by SSBBM
Shared by Jman13
_____________________________
^ Back to BYOB Blocks
^ Back to Contents
█ █ █ █ █ █ █ █ █
Last edited by YourLocalBlockLib (2011-08-30 18:38:56)
Offline
Pen
Shared by PlayWithFire
Shared by Jonathanpb
Shared by Chrischb
Shared by Chrischb
Shared by SSBBM
Shared by SSBBM
Shared by SSBBM
Shared by subzerostig
Shared by subzerostig
Shared by MathWizz
Shared by ProgrammingFreak
Shared by Scimonster, based on the block by ProgrammingFreak
Shared by SSBBM
Shared by Flashgocrazy
Shared by Flashgocrazy
_____________________________
^ Back to BYOB Blocks
^ Back to Contents
█ █ █ █ █ █ █ █ █
Last edited by YourLocalBlockLib (2011-08-23 15:37:29)
Offline
Variables and Lists
Shared by nXIII, improved by owetre18
Shared by SSBBM
Shared by SSBBM
Shared by SSBBM
Shared by SSBBM
Shared by Scimonster, Improved by SSBBM
Shared by Scimonster, Improved by SSBBM
Shared by SSBBM
Shared by roijac
_____________________________
^ Back to BYOB Blocks
^ Back to Contents
█ █ █ █ █ █ █ █ █
Last edited by YourLocalBlockLib (2011-07-11 11:54:07)
Offline
Offline
Visit the panther site
How to add one of these blocks:
To use the Panther coded blocks, you need to download Panther from this link.
How do I make a Panther block from the library?
Motion
Control
Looks
Sensing
Sound
Operators
Pen
Variables
Files
Colors
home
Last edited by YourLocalBlockLib (2011-08-23 14:47:56)
Offline
Offline
Control
Shared by Sparks
Block number: [1] [view source] [What is this?]
Notes:
This block opens the camera window.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Shared by Billyedward
Block number: [2] [view source] [What is this?]
Notes:
This block opens your default web browser with the web-page typed into the box.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Shared by Unknown
Block number: [3] [view source] [What is this?]
Notes:
• 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 disappear 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.
• Does not work in presentation mode.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Shared by Unknown
Block number: [4] [view source] [What is this?]
Notes:
• This block permanently deletes the sprite that runs it. Unlike the standard delete block in Panther, this block can delete original (not a clone) sprites so use it with care.
• Does not work in presentation mode.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Shared by Billybob-Mario
Block number: [5] [view source] [What is this?]
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Shared by zorket and adapted to Panther by Sparks
Block number: [6] [view source] [What is this?]
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Shared by Sparks (Based on the above block)
Block number: [7] [view source] [What is this?]
Notes:
This block opens the "my stuff" page for the username you type.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Shared by Sparks, based on the scratch block by Zorket.
Block number: [8] [view source] [What is this?]
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Shared by Sparks, based on the scratch block by Zorket.
Block number: [9] [view source] [What is this?]
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Shared by Sparks, based on the scratch block by Zorket.
Block number: [10] [view source] [What is this?]
Notes:
This block lets you set the stepping speed. (0 = turbo speed 1 = normal speed).
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Shared by Sparks
Block number: [49] [view source] [What is this?]
^ Back to Panther Blocks
^ Back to Contents
█ █ █ █ █ █ █ █ █ █
Last edited by YourLocalBlockLib (2011-07-11 12:06:02)
Offline
Looks
Shared by sonicjosh, converted by Sparks
Block number: [11] [view source] [What is this?]
________________________________________________________________________________
Shared by MathWizz
Block number: [47] [view source] [What is this?]
________________________________________________________________________________
Shared by Sparks
Block number: [51] [view source] [What is this?]
Notes:
Works with png, gif and bmp files.
^ Back to Panther Blocks
^ Back to Contents
█ █ █ █ █ █ █ █ █ █
Last edited by YourLocalBlockLib (2011-07-11 12:06:11)
Offline
Sensing
Shared by johnnydean1
Block number: [12] [view source] [What is this?]
Notes:
Opens a dialog box with yes and no options.
________________________________________________________________________________
Shared by johnnydean1
Block number: [13] [view source] [What is this?]
Notes:
Opens a dialog with a text box. Sets the answer variable to your answer. (Yes, this block already exists in Panther )
________________________________________________________________________________
Shared by johnnydean1
Block number: [14] [view source] [What is this?]
Notes:
This block tells a user if they are in presentation mode or not. Very useful.
________________________________________________________________________________
Shared by johnnydean1
Block number: [15] [view source] [What is this?]
________________________________________________________________________________
Shared by floppy_gunk
Block number: [36] [view source] [What is this?]
________________________________________________________________________________
Shared by floppy_gunk
Block number: [37] [view source] [What is this?]
Notes:
It conflicts with right-click menus in normal viewing mode so this works better in presentation mode.
________________________________________________________________________________
Shared by johnnydean1
Block number: [38] [view source] [What is this?]
What this block does:
This block reports a random friend from the Scratch friend list of the given user.
________________________________________________________________________________
Shared by johnnydean1
Block number: [39] [view source] [What is this?]
What this block does:
This block reports a friend of the given Scratcher. Enter a number to see that friend from their online friend list.
________________________________________________________________________________
Shared by Pecola1
Block number: [40] [view source] [What is this?]
What this block does:
Reports whether the password for the username that is inserted is the right password. Useful for making a project which requires you have a Scratch account.
________________________________________________________________________________
Shared by Sparks
Block number: [41] [view source] [What is this?]
What this block does:
Reports the location of the panther.image being run on the computer. This can be used to write files to sub-folders of the Panther folder!
________________________________________________________________________________
Shared by Pecola1, edited by Sparks
Block number: [56] [view source] [What is this?]
________________________________________________________________________________
Shared by Sparks
Block number: [60] [view source] [What is this?]
^ Back to Panther Blocks
^ Back to Contents
█ █ █ █ █ █ █ █ █ █
Last edited by YourLocalBlockLib (2011-07-21 10:43:21)
Offline