This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#2926 2012-06-08 05:02:59

computerexpertFELIX
Scratcher
Registered: 2012-05-10
Posts: 5

Re: ITopic: Welcome to your local block library!

I don't know the code for this block and I don't have the image.
Here is it.
It's a sensing block and here is it's string.
Question.
It reports the last question asked with the ask blocks.

Offline

 

#2927 2012-06-08 09:08:28

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: ITopic: Welcome to your local block library!

computerexpertFELIX wrote:

I don't know the code for this block and I don't have the image.
Here is it.
It's a sensing block and here is it's string.
Question.
It reports the last question asked with the ask blocks.

I could make it.

Offline

 

#2928 2012-06-08 18:07:43

P110
Scratcher
Registered: 2011-04-12
Posts: 500+

Re: ITopic: Welcome to your local block library!

Hey Sparks, you know panther, how did you get the toggle button for block making there, I have all the needed files, but I need to know how to get the button there. , oh and what procedures do you go through to add new categories , if you don't know or can't tell me that's fine

Last edited by P110 (2012-06-09 09:41:10)


Me live on 2.0 now  sad

Offline

 

#2929 2012-06-09 09:01:50

777w
Scratcher
Registered: 2009-02-10
Posts: 1000+

Re: ITopic: Welcome to your local block library!

lol i just noticed the panther "download block" block gives you a message that says "sucess!"

Offline

 

#2930 2012-06-09 21:09:43

fetchydog567
Scratcher
Registered: 2011-12-28
Posts: 500+

Re: ITopic: Welcome to your local block library!

REQUEST: A scratch block that opens the paint editor.


http://www.minecraftanonymous.com/assets/banners/banner_51.pngJust a reminder I won't be on Scratch that much but I 'll still be here, so if i'm on something, I will be commenting back, okay! wink , PICO Team!!!!!!!!!!! SCRATCH DEADW!!! PICO HACK ACCOUTNTT@@

Offline

 

#2931 2012-06-09 23:16:33

Jrocket97
Scratcher
Registered: 2009-10-03
Posts: 100+

Re: ITopic: Welcome to your local block library!

lol, that got completely ignored.

Offline

 

#2932 2012-06-10 11:26:45

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: ITopic: Welcome to your local block library!

fetchydog567 wrote:

REQUEST: A scratch block that opens the paint editor.

Not sure if this has been done already, but:

('open paint editor' #- #editDrawing)

No code.   smile

Offline

 

#2933 2012-06-11 03:37:26

Jonathan50
Scratcher
Registered: 2011-07-06
Posts: 100+

Re: ITopic: Welcome to your local block library!

YourLocalBlockLib wrote:

http://dl.dropbox.com/u/6273449/BlockLibraryTitle.png
^Back to Scratch blocks
http://scratch.mit.edu/redirect/url?lin … ibDiv2.png
http://scratch.mit.edu/redirect/url?lin … 621999.png
http://scratch.mit.edu/redirect/url?lin … ibDiv2.png

How to download a Scratch block
Credit to nXIII for his patcher, which this code was based on.

This is a way how you can make an "import block" item in the file menu so you can download and import blocks from the library.

Beware: this feature is untested! If you want to test it for us, great, but don't use this in your production environment yet!

The Importer
Installing the block importer is the hardest (but not very hard) thing you must do in order to import blocks. Simply follow these instructions:
Step 1: Open Scratch
Step 2: Press and hold the "shift" key while clicking the loop of the "R" in the Scratch logo
Step 3: Select "turn fill-screen off" from the popup menu which shows up
Not showing up? Make sure you're clicking inside the loop of the "R"; the "logo" referred to is the one that says "Scratch" in the top-left corner.
Step 4: Click anywhere in the "white space" which shows up at the bottom and right sides of the window
Step 5: Select "open..." from the popup menu
Step 6: Select "workspace" from the subsequent popup menu
Step 7: Copy the following text and paste it into the textbox-like window with (Windows) Alt+V or (Mac) Command+V, or by clicking the "-" button above the scrollbar (appears when the mouse is over the "workspace" window) and selecting "paste (v)"

Code:

'From MIT Squeak 0.9.4 (June 1, 2003) [No updates present.] on 18 June 2010 at 5:06:17 pm'!

!ScratchFileChooserDialog methodsFor: 'initialization'!
createBlockFileChooserFor: t1 
    scratchFrame _ nil.
    readingScratchFile _ true.
    list _ ScratchFilePicker new extensions: #(#block ).
    self removeAllMorphs.
    bottomSpacer delete.
    bottomSpacer _ nil.
    mainColumn addMorphBack: list.
    self title: 'Import Block'.
    list scratchInfoClient: nil.
    mainColumn addMorphBack: (Morph new extent: 5 @ 9;
         color: Color transparent);
     addMorphBack: newTitleBin.
    fileInfoColumn addMorphBack: buttonRow.
    self addMorphBack: shortcutColumn;
     addMorphBack: mainColumn;
     addMorphBack: fileInfoColumn! !


!ScratchFrameMorph methodsFor: 'menu/button actions'!
addBlock
    | t1 t2 t3 t4 |
    t1 _ ScratchFileChooserDialog new createBlockFileChooserFor: self;
             type: #block.
    t2 _ t1 getUserResponse.
    t2 = #cancelled ifTrue: [^ self].
    t3 _ (FileDirectory forFileName: t2)
                oldFileNamed: t2.
    t4 _ t3 contentsOfEntireFile.
    (ReadWriteStream
        on: t4
        from: 1
        to: t4 size) fileIn! !

!ScratchFrameMorph methodsFor: 'menu/button actions'!
fileMenu: t1 
    | t2 |
    t2 _ CustomMenu new.
    t2 add: 'New' action: #newScratchProject.
    t2 add: 'Open' action: #openScratchProject.
    t2 add: 'Save' action: #saveScratchProjectNoDialog.
    t2 add: 'Save As' action: #saveScratchProject.
    t2 addLine.
    t2 add: 'Import Project' action: #importScratchProject.
    t2 add: 'Export Sprite' action: #exportSprite.
    t2 addLine.
    t2 add: 'Import Block' action: #addBlock.
    t2 addLine.
    t2 add: 'Project Notes' action: #editNotes.
    Sensor shiftPressed
        ifTrue: 
            [t2 addLine.
            t2 add: 'Write Project Summary' action: #writeSummaryFile.
            t2 add: 'Write Multiple Project Summaries' action: #writeMultipleSummaries].
    t2 addLine.
    t2 add: 'Quit' action: #quitScratch.
    t2 localize.
    #(2 4 5 6 7 8 ) do: [:t3 | t2 labels at: t3 put: ((t2 labels at: t3)
                copyFrom: 1 to: (t2 labels at: t3) size - 1)
                , ScratchTranslator ellipsesSuffix].
    t2 invokeOn: self at: t1 bottomLeft + (0 @ 10)! !

Step 8: Select all the text by click-and-drag or by pressing (Windows) Alt+A or (Mac) Command+A
Step 9: File in the selection by clicking on the "-" in the top left corner; choosing "more...", then "file it in"
Step 10: Shift-click the loop of the "R" in the Scratch logo again and select "save image for end-user" then select "yes" when prompted. Scratch should close, and when restarted you will see a new option in the file menu: "Import Block..."

http://scratch.mit.edu/redirect/url?lin … ibDiv2.png

^Back to Scratch blocks

I looked at the new method it added to the system browser. It appears it gets Smalltalk code from the file and files it in. That means you could make a fake block file that installs new morph types or deletes everything in the entire image file!!!!! On Panther to access the things you do with Shift-Click R on Scratch you use the source image wich has a menu called 'Dev'. So it could also do some like install this block:

[!random colorina!]
(supposed to be a color block.)


Jonathan50
big_smile  http://scratch.mit.edu/img/pages/credits/cat-face-bullet.gif http://blocks.scratchr.org/API.php?user=Jonathan50&action=onlineStatus&type=square         http://blocks.scratchr.org/API.php?user=Jonathan50&action=projects&type=newest&return=image&num=1

Offline

 

#2934 2012-06-11 03:45:19

Jonathan50
Scratcher
Registered: 2011-07-06
Posts: 100+

Re: ITopic: Welcome to your local block library!

YourLocalBlockLib wrote:

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!

http://dl.dropbox.com/u/6273449/BlockLibraryTitle.png
.       
.                                     http://scratch.mit.edu/redirect/url?lin … 826509.gif
.                             http://scratch.mit.edu/redirect/url?lin … 041909.gif
.                                    http://scratch.mit.edu/redirect/url?lin … 428862.gif

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!

http://scratch.mit.edu/redirect/url?lin … 942334.gif

http://scratch.mit.edu/redirect/url?lin … 732043.gif

http://scratch.mit.edu/redirect/url?lin … 967135.gif

So to all you curious Scratchers and viewers alike, I bid you welcome. Welcome to the Library!

http://scratch.mit.edu/redirect/url?lin … 841103.gif

Your Local Block Library Block Count:
http://scratch.mit.edu/redirect/url?lin … ratch1.gifhttp://scratch.mit.edu/redirect/url?lin … 449/s1.gifhttp://scratch.mit.edu/redirect/url?lin … 449/s6.gifhttp://scratch.mit.edu/redirect/url?lin … 449/s7.gifhttp://scratch.mit.edu/redirect/url?lin … ratch2.gif       http://scratch.mit.edu/redirect/url?lin … /byob1.gifhttp://scratch.mit.edu/redirect/url?lin … 449/b1.gifhttp://scratch.mit.edu/redirect/url?lin … 449/b4.gifhttp://scratch.mit.edu/redirect/url?lin … 449/b3.gifhttp://scratch.mit.edu/redirect/url?lin … /byob2.gif         http://scratch.mit.edu/redirect/url?lin … nther1.gifhttp://scratch.mit.edu/redirect/url?lin … 449/p6.gifhttp://scratch.mit.edu/redirect/url?lin … 449/p0.gifhttp://scratch.mit.edu/redirect/url?lin … nther2.gif
_________________________________
Want to add to the library? Please do! Comment below for it to be added.
_________________________________
Librarians
http://blocks.scratchr.org/libstatus.php?user=sparks Sparks About Sparks
http://blocks.scratchr.org/libstatus.php?user=SSBBM SSBBM About SSBBM
http://blocks.scratchr.org/libstatus.php?user=Pecola1 Pecola1 About Pecola1
http://blocks.scratchr.org/libstatus.ph … scimonster Scimonster About Scimonster
http://blocks.scratchr.org/libstatus.ph … meowmeow55 Meowmeow55
http://blocks.scratchr.org/libstatus.php?user=Greenatic Greenatic About Greenatic
http://blocks.scratchr.org/libstatus.ph … ype=square YourLocalBlockLib The Block Library Experience

Past Librarians
http://blocks.scratchr.org/libstatus.ph … esuccessor 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

Did you say just post to request a scratchblock?
the blockspec is ('one item menu %s' #- #oneItemMenu:)
the procedure is called oneItemMenu:
it's code is

Code:

oneItemMenu: t1
       | menu |
        menu _ customMenu new.
        menu add: t1.

do tab instead of the spaces (tab is what you get when you press the tab key.)


Jonathan50
big_smile  http://scratch.mit.edu/img/pages/credits/cat-face-bullet.gif http://blocks.scratchr.org/API.php?user=Jonathan50&action=onlineStatus&type=square         http://blocks.scratchr.org/API.php?user=Jonathan50&action=projects&type=newest&return=image&num=1

Offline

 

#2935 2012-06-11 09:53:23

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: ITopic: Welcome to your local block library!

Jonathan50 wrote:

Did you say just post to request a scratchblock?
the blockspec is ('one item menu %s' #- #oneItemMenu:)
the procedure is called oneItemMenu:
it's code is

Code:

oneItemMenu: t1
       | menu |
        menu _ customMenu new.
        menu add: t1.

do tab instead of the spaces (tab is what you get when you press the tab key.)

Try to avoid quoting the entire first post--it's huge.   tongue

That method won't work, for multiple reasons:
1.  It's CustomMenu, not customMenu.
2.  There needs to be an action: for the add: method.  See below method.
3.  There's nothing to start-up the list.

Try this method instead:

Code:

oneItemMenu: t1
| menu |
        menu _ CustomMenu new.
        menu add: t1 action: ''.
^ menu localize startUp

Offline

 

#2936 2012-06-11 12:10:03

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: ITopic: Welcome to your local block library!

or you could use this block

Code:

('menu from list' #r #menuFromList:)
========================================================================
menuFromList: t1 
    | t3 |
    t3 _ CustomMenu new.
    (self listNamed: t1 ifNone: [^ '']) listContents
        do: [:t2 | t2 asString = '#-' ifTrue: [t3 addLine] ifFalse: [t3 add: t2 asString action: t2 asString].].
    ^ t3 startUp

adding '#-' to your list adds a line to the menu.

Offline

 

#2937 2012-06-11 12:30:32

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: ITopic: Welcome to your local block library!

the last question asked block would require an instance variable to be added but otherwise it's pretty simple.
declare the variable lastQuestion by typing this code and doing it

Code:

ScriptableScratchMorph addInstVarName: 'lastQuestion'

blockspec

Code:

('last question' #r #lastQuestion)

ScriptableScratchMorph

Code:

lastQuestion
^ lastQuestion

ScriptableScratchMorph

Code:

lastQuestion: t1
^ lastQuestion

ScratchProcess

Code:

doAsk
    "Ask the user a question and wait until the user types some text and hits the accept button."

    | block args question prompter |
    block _ stackFrame expression.
    args _ stackFrame arguments.

    "first time (args size = 0): open prompter"
    args size = 0
        ifTrue: [
            block receiver promptInProgress ifTrue: [
                self pushStackFrame: (ScratchStackFrame new shouldYield: true).
                ^ self].
            question _ block args first asString.
            prompter _ block receiver promptForInput: question]
        ifFalse: [
            prompter _ args first].

    "if all processes have stopped, pop this frame and we're done."
    prompter isDone ifTrue: [^ self popStackFrame].

    "Set up the wait loop. We need to:
        1.  yield to another process
        2.  evaluate the termination expression again
    Push these onto stack in reverse order."

    "2.  evaluate this block again"
    "(Remove the current frame and replace it with one that will force the termination expression to be re-evaluated.)"
    self popStackFrameNoUnhightlight.
    self pushStackFrame: (ScratchStackFrame new expression: block; addArgument: prompter).
    stackFrame expression receiver lastQuestion: question.
    "1.  yield to another process"
    self pushStackFrame: (ScratchStackFrame new shouldYield: true).

Offline

 

#2938 2012-06-15 10:56:33

stickdude123
Scratcher
Registered: 2010-05-31
Posts: 100+

Re: ITopic: Welcome to your local block library!

i bump for u  smile


http://internetometer.com/imagesmall/34259.png http://www.mediafire.com/convkey/418e/lkb7wmv2n2k73rz5g.jpg         http://blocks.scratchr.org/API.php?user=stickdude123&action=onlineStatus&type=square

Offline

 

#2939 2012-06-16 22:25:51

P110
Scratcher
Registered: 2011-04-12
Posts: 500+

Re: ITopic: Welcome to your local block library!

hey I really need help with these blocks. Thanks!


Me live on 2.0 now  sad

Offline

 

#2940 2012-06-17 03:43:46

P110
Scratcher
Registered: 2011-04-12
Posts: 500+

Re: ITopic: Welcome to your local block library!

I bump for my post


Me live on 2.0 now  sad

Offline

 

#2941 2012-06-21 06:30:11

fetchydog567
Scratcher
Registered: 2011-12-28
Posts: 500+

Re: ITopic: Welcome to your local block library!

Requset:

[close scratch]


http://www.minecraftanonymous.com/assets/banners/banner_51.pngJust a reminder I won't be on Scratch that much but I 'll still be here, so if i'm on something, I will be commenting back, okay! wink , PICO Team!!!!!!!!!!! SCRATCH DEADW!!! PICO HACK ACCOUTNTT@@

Offline

 

#2942 2012-06-21 06:49:46

nathanprocks
Scratcher
Registered: 2011-04-14
Posts: 1000+

Re: ITopic: Welcome to your local block library!

fetchydog567 wrote:

Requset:

[close scratch]

That block already exists:

Shared by Pecola1
Blockspec:

Code:

('quit Scratch' #- #exitScratch)

Code:

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)


http://carrot.cassiedragonandfriends.org/Scratch_Signature/randomsig.php
http://trinary.site40.net/images/scratchrank.php?username=nathanprocks&display=small

Offline

 

#2943 2012-06-21 07:23:41

P110
Scratcher
Registered: 2011-04-12
Posts: 500+

Re: ITopic: Welcome to your local block library!

P110 wrote:

hey I really need help with these blocks. Thanks!


Me live on 2.0 now  sad

Offline

 

#2944 2012-06-21 08:01:34

fetchydog567
Scratcher
Registered: 2011-12-28
Posts: 500+

Re: ITopic: Welcome to your local block library!

exit panther


http://www.minecraftanonymous.com/assets/banners/banner_51.pngJust a reminder I won't be on Scratch that much but I 'll still be here, so if i'm on something, I will be commenting back, okay! wink , PICO Team!!!!!!!!!!! SCRATCH DEADW!!! PICO HACK ACCOUTNTT@@

Offline

 

#2945 2012-06-21 08:14:09

nathanprocks
Scratcher
Registered: 2011-04-14
Posts: 1000+

Re: ITopic: Welcome to your local block library!

fetchydog567 wrote:

exit panther

Exit Panther uses the same code as the exit Scratch block. You can just change the blockspec to make the block say "exit Panther" instead of "exit Scratch".


http://carrot.cassiedragonandfriends.org/Scratch_Signature/randomsig.php
http://trinary.site40.net/images/scratchrank.php?username=nathanprocks&display=small

Offline

 

#2946 2012-06-21 09:35:51

P110
Scratcher
Registered: 2011-04-12
Posts: 500+

Re: ITopic: Welcome to your local block library!

P110 wrote:

P110 wrote:

hey I really need help with these blocks. Thanks!


Me live on 2.0 now  sad

Offline

 

#2947 2012-06-21 12:36:37

Squawkers13
Scratcher
Registered: 2010-11-20
Posts: 500+

Re: ITopic: Welcome to your local block library!

P110 wrote:

P110 wrote:

P110 wrote:

hey I really need help with these blocks. Thanks!

stop quoting yourself!
Find out how to mod BYOB!!!


http://pekkit.net/banners/pekkit.png

Offline

 

#2948 2012-06-21 13:11:53

777w
Scratcher
Registered: 2009-02-10
Posts: 1000+

Re: ITopic: Welcome to your local block library!

Squawkers13 wrote:

P110 wrote:

P110 wrote:


stop quoting yourself!
Find out how to mod BYOB!!!

in spanish?

Offline

 

#2949 2012-06-21 13:43:57

P110
Scratcher
Registered: 2011-04-12
Posts: 500+

Re: ITopic: Welcome to your local block library!

777w wrote:

Squawkers13 wrote:

P110 wrote:


stop quoting yourself!
Find out how to mod BYOB!!!

in spanish?

I have tried! But I can't! I'll try again...


Me live on 2.0 now  sad

Offline

 

#2950 2012-06-21 15:47:55

Randomno
Scratcher
Registered: 2012-06-04
Posts: 39

Re: ITopic: Welcome to your local block library!

I have an idea for a block: random number. It reports the most recent number chosen by the

pick random [1] to [10]
block.


http://img209.imageshack.us/img209/5524/randomno.png
I do stuff with stuff. I also stuff stuff.

Offline

 

Board footer