#4 2011-03-16 15:55:37

YourLocalBlockLib
Scratcher
Registered: 2011-03-10
Posts: 100+

Re: ITopic: Welcome to your local block library!

Control
/img/tinypic/2yvj4w5.jpg
/img/dropbox/BlockLibDiv2.png
/img/weebly/2710344.gif
Shared by Sparks
blockspec:

('open camera window' #- #takePhoto)

no code needed

What it does:
Opens the webcam control window and lets you take photos.

/img/dropbox/BlockLibDiv2.png

/img/weebly/7159808.gif
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!

/img/dropbox/BlockLibDiv2.png

/img/weebly/7422386.gif
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)

/img/dropbox/BlockLibDiv2.png

/img/weebly/2618828.gif
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!

/img/dropbox/BlockLibDiv2.png

/img/weebly/5728280.gif
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.

/img/dropbox/BlockLibDiv2.png

/img/weebly/7283138.gif
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.
/img/dropbox/BlockLibDiv2.png
/img/weebly/3573352.gif
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.

/img/dropbox/BlockLibDiv2.png

/img/tinypic/5bqjxh.jpg/img/weebly/398367773.gif 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.

/img/dropbox/BlockLibDiv2.png

/img/tinypic/5bqjxh.jpg/img/weebly/272488031.gif 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).

/img/dropbox/BlockLibDiv2.png

/img/tinypic/5bqjxh.jpg/img/weebly/812378062.gif 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).

/img/dropbox/BlockLibDiv2.png

/img/weebly/941681504.gif Shared by Pecola1
Blockspec:

('enable programmer facilities' #- #enableProgrammerFacilities)

Code:

enableProgrammerFacilities
    Preferences enableProgrammerFacilities

What it does:
Enables the programmer facilities (info).

/img/dropbox/BlockLibDiv2.png

/img/weebly/919498.gif 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)

/img/dropbox/BlockLibDiv2.png
/img/weebly/697242.gif 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)

/img/dropbox/BlockLibDiv2.png

/img/weebly/305000.gif 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

/img/dropbox/BlockLibDiv2.png

/img/weebly/2161291.gif 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.

/img/dropbox/BlockLibDiv2.png

/img/weebly/5687837.gif 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.

/img/dropbox/BlockLibDiv2.png

/img/weebly/697242.gif 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.

/img/dropbox/BlockLibDiv2.png

/img/weebly/9966763.gif?318 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).

/img/dropbox/BlockLibDiv2.png

/img/weebly/6038008.gif 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.

/img/dropbox/BlockLibDiv2.png

/img/weebly/4835659.gif?310 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.

/img/dropbox/BlockLibDiv2.png

/img/freeimagehosting/uploads/27cea963f8.gif 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."

/img/dropbox/BlockLibDiv2.png

/img/weebly/6600351.gif Shared by jslomba, improved by TheSuccessor
Blockspec:

('' #W #-)

Code:

ScratchFrameMorph->processWhenConditions and
OffscreenWorldMorph->processWhenConditions

Delete this line:

true ifTrue: [^ self]

/img/dropbox/BlockLibDiv2.png

/img/weebly/7181233.gif 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.

/img/dropbox/BlockLibDiv2.png

/img/weebly/4217699.gif 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.

/img/dropbox/BlockLibDiv2.png

/img/weebly/4712934.gif 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!

/img/dropbox/BlockLibDiv2.png

^ Back to Scratch Blocks
^ Back to Contents
 

Last edited by YourLocalBlockLib (2011-09-09 03:49:35)


/img/dropbox/BlockLibraryTitle.png

Offline