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

#401 2010-10-27 14:26:29

ProgrammingFreak
Scratcher
Registered: 2010-09-04
Posts: 1000+

Re: Welcome to the OLD local block library!

cool! sparks! can you do a write() block?

Offline

 

#402 2010-10-27 14:50:33

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Welcome to the OLD local block library!

write what? if you want to write text to a file, you need a code like this:

write $String$ to file $String$                    -

writeText: t1 toFile: t2

simple as that!
well, that's a Panther block anyway. A good thing to remember is that you can't write $number$ arguments to a file, so if you wanted to write a block say, called "write $Number$ to file $String$", you would first have to turn the contents of the number argument into a string (asString) like this:

writeText: t1 asString toFile: t2

not sure this is relevant to your question, but it seriously helps if you know about the asString  tongue


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#403 2010-10-29 16:43:47

zorket
Scratcher
Registered: 2010-05-25
Posts: 500+

Re: Welcome to the OLD local block library!

Oops! Accidently opened a closet of blocks.

(pi) operators by zorket

blockspec:

('pi' #r #getPi

Code:

getPi
^ 3.141592653

( (color) effect) looks by ls97

blockspec:

('%g effect' #r #getEffect: 'color')

Code:

getEffect: t1 
    filterPack ifNil: [^ 0].
    'blur' = t1 ifTrue: [^ filterPack blur].
    'brightness' = t1 ifTrue: [^ filterPack brightnessShift].
    'fisheye' = t1 ifTrue: [^ filterPack fisheye].
    'color' = t1 ifTrue: [^ filterPack hueShift].
    'colour' = t1 ifTrue: [^ filterPack hueShift].
    'mosaic' = t1 ifTrue: [^ filterPack mosaicCount].
    'pixelate' = t1 ifTrue: [^ filterPack pixelateCount].
    'pointillize' = t1 ifTrue: [^ filterPack pointillizeSize].
    'saturation' = t1 ifTrue: [^ filterPack saturationShift].
    'transparency' = t1 | ('ghost' = t1) ifTrue: [^ self transparency].
    'whirl' = t1 ifTrue: [^ filterPack whirl]

To get extra effects:

scratchObjs > scriptable scratch morph > all > graphic effect names

graphicEffectNames
^ #('color' 'fisheye' 'whirl' 'pixelate' 'mosaic' 'ghost' 'pointillize' blur' 'saturation' ).

It looks like only 2 blocks were in there, luckily.

Last edited by zorket (2010-10-30 16:48:17)


Marzipan11 must learn to not spoil

Offline

 

#404 2010-10-30 18:58:50

Marioblender
Scratcher
Registered: 2010-04-04
Posts: 31

Re: Welcome to the OLD local block library!

sparks wrote:

Control
http://i51.tinypic.com/2yvj4w5.jpg
http://dl.dropbox.com/u/6273449/BlockLibDiv2.png
http://www.weebly.com/uploads/4/0/7/6/4 … 710344.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.
http://dl.dropbox.com/u/6273449/BlockLibDiv2.png
http://www.weebly.com/uploads/4/0/7/6/4 … 159808.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!
http://dl.dropbox.com/u/6273449/BlockLibDiv2.png
http://www.weebly.com/uploads/4/0/7/6/4 … 422386.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.
http://dl.dropbox.com/u/6273449/BlockLibDiv2.png
http://www.weebly.com/uploads/4/0/7/6/4 … 618828.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!
http://dl.dropbox.com/u/6273449/BlockLibDiv2.png
http://www.weebly.com/uploads/4/0/7/6/4 … 728280.gif
Shared by zorket (made by rubiks_cube_guy238)
blockspec:

(I recieve %e' #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.
http://dl.dropbox.com/u/6273449/BlockLibDiv2.png
http://www.weebly.com/uploads/4/0/7/6/4 … 956901.gif
Shared by midnightleopard
blockspec:

('%j %s' #- #doThis:on:)

code (place under sensing ops)

doThis: t1 on: t2
    | engines l |
    '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 -> command block morph -> private -> uncoloredArgMorphFor:
then delete all of that code and replace it with:)

Code:

uncoloredArgMorphFor: t1 
    | t2 |
    t2 _ t1 at: 2.
    $a = t2 ifTrue: [^ AttributeArgMorph new choice: 'volume'].
    $b = t2 ifTrue: [^ BooleanArgMorph new].
    $c = t2 ifTrue: [^ ColorArgMorph new showPalette: true].
    $C = t2 ifTrue: [^ ColorArgMorph new showPalette: false].
    $d = t2 ifTrue: [^ ExpressionArgMorphWithMenu new numExpression: '0';
         menuSelector: #directionMenu].
    $D = t2 ifTrue: [^ ExpressionArgMorphWithMenu new numExpression: '48';
         menuSelector: #midiDrumMenu].
    $R = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #operatorNames;
         choice: '+'].
    $e = t2 ifTrue: [^ EventTitleMorph new].
    $f = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #mathFunctionNames;
         choice: 'sqrt'].
    $g = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #graphicEffectNames;
         choice: 'color'].
    $j = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #engineNames;
         choice: 'google'].
    $H = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #hookupSensorNames].
    $h = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #hookupBooleanSensorNames].
    $I = t2 ifTrue: [^ ExpressionArgMorphWithMenu new numExpression: '1';
         menuSelector: #midiInstrumentMenu].
    $i = t2 ifTrue: [^ ExpressionArgMorphWithMenu new numExpression: '1';
         menuSelector: #listIndexMenu].
    $k = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #keyNames;
         choice: 'space'].
    $L = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #listVarMenu].
    $l = t2 ifTrue: [^ ChoiceOrExpressionArgMorph new getOptionsSelector: #costumeNames;
         choice: 'costume1'].
    $m = t2 ifTrue: [^ SpriteArgMorph new].
    $M = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #motorNames].
    $n = t2 ifTrue: [^ ExpressionArgMorph new numExpression: '10'].
    $N = t2 ifTrue: [^ ExpressionArgMorphWithMenu new numExpression: '60';
         menuSelector: #noteSelector].
    $s = t2 ifTrue: [^ ExpressionArgMorph new stringExpression: ''].
    $S = t2 ifTrue: [^ ChoiceOrExpressionArgMorph new getOptionsSelector: #soundNames;
         choice: 'pop'].
    $v = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #varNamesMenu;
         choice: ''].
    $W = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #motorDirection].
    $x = t2 ifTrue: [^ ChoiceOrExpressionArgMorph new getOptionsSelector: #sceneNames;
         choice: ''].
    $y = t2 ifTrue: [^ ExpressionArgMorphWithMenu new numExpression: '1';
         menuSelector: #listIndexForDeleteMenu].
    ^ ExpressionArgMorph new numExpression: '10'

last bit of code (scratch objects -> scriptable scratch morph -> 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)
http://dl.dropbox.com/u/6273449/BlockLibDiv2.png
^ Back to Scratch Blocks
^ Back to Contents

Can You include Bing too?

Offline

 

#405 2010-10-30 19:10:19

Marioblender
Scratcher
Registered: 2010-04-04
Posts: 31

Re: Welcome to the OLD local block library!

sparks wrote:

Motion
http://i53.tinypic.com/29wri81.jpg
http://dl.dropbox.com/u/6273449/BlockLibDiv2.png
No blocks. Be the first to post a scratch motion block! Just comment below with the code!
http://dl.dropbox.com/u/6273449/BlockLibDiv2.png

^ Back to Scratch Blocks
^ Back to Contents

Also, can you add <make %m move 10 steps>?  neutral  Shared by Marioblender (requested by hpotter134, coded by ScratchReallyROCKS)

method:

Code:

move: sprite forward: distance 
    sprite forward: distance

spec:

Code:

('make %m move %n steps' #- #move:forward:)

Offline

 

#406 2010-10-31 07:18:54

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Welcome to the OLD local block library!

I can indeed add that block! I think that the blocks in the scratch section work with pretty much any mod of Scratch as you're editing the source. They don't work with Panther because Panther has different ways of representing arguments, and I have no idea if they would work with BYOB, but I think that pretty much any mod can use the blocks from the scratch section  smile


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#407 2010-10-31 09:03:03

sonicjosh
Scratcher
Registered: 2007-10-28
Posts: 86

Re: Welcome to the OLD local block library!

I don't think it already here so, ('draw new costume' - drawNewCostume). No code needed!

(P.S. Sorry if it is already here...)


http://i35.tinypic.com/14yacn6.jpg
Need help with your mod? Visit Mod Central!

Offline

 

#408 2010-10-31 09:07:29

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Welcome to the OLD local block library!

no, I don't think it is  smile  that's a cool block, thanks sonicjosh! I'll convert it to Panther too  smile


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#409 2010-10-31 09:17:34

sonicjosh
Scratcher
Registered: 2007-10-28
Posts: 86

Re: Welcome to the OLD local block library!

wink  People could use it to make a game where you draw the character! Is this there? ('delete sprite' - deleteSprite)


http://i35.tinypic.com/14yacn6.jpg
Need help with your mod? Visit Mod Central!

Offline

 

#410 2010-10-31 09:56:01

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Welcome to the OLD local block library!

yes, "delete sprite" is there, though the code is usually typed "undoableDeleteSprite" ( I think, that might just be Panther)

MarioBlender, I don't know alot about squeak code, but I'm not certain that the code you posted for "Move %m %n steps" will work, can someone verify that's a working squeak code? Thanks  smile


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#411 2010-10-31 11:46:04

sonicjosh
Scratcher
Registered: 2007-10-28
Posts: 86

Re: Welcome to the OLD local block library!

My delete sprite code is simpler!  smile  It works so my one is kind of better...


http://i35.tinypic.com/14yacn6.jpg
Need help with your mod? Visit Mod Central!

Offline

 

#412 2010-10-31 11:50:40

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Welcome to the OLD local block library!

that's true, I don't know why it has "undoable" at the start...


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#413 2010-10-31 12:11:34

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: Welcome to the OLD local block library!

sparks wrote:

that's true, I don't know why it has "undoable" at the start...

It's the method for deleting a sprite from the context menu, which can always be "undone" be selecting "undelete" from the edit menu. It just saves the sprite for SF's undelete.

Just a note: don't forget OffscreenWorldMorphs. "self ownerThatIsA: ScratchFrameMorph" won't work in presentation mode.

Last edited by nXIII (2010-10-31 12:12:50)


nXIII

Offline

 

#414 2010-10-31 12:14:01

sonicjosh
Scratcher
Registered: 2007-10-28
Posts: 86

Re: Welcome to the OLD local block library!

^So that's why!


http://i35.tinypic.com/14yacn6.jpg
Need help with your mod? Visit Mod Central!

Offline

 

#415 2010-10-31 12:56:42

Marioblender
Scratcher
Registered: 2010-04-04
Posts: 31

Re: Welcome to the OLD local block library!

sparks wrote:

yes, "delete sprite" is there, though the code is usually typed "undoableDeleteSprite" ( I think, that might just be Panther)

MarioBlender, I don't know alot about squeak code, but I'm not certain that the code you posted for "Move %m %n steps" will work, can someone verify that's a working squeak code? Thanks  smile

sparks, I tested the block already and here is the picture:
https://lh6.googleusercontent.com/B1X3VvW6MCN1Jea7DdaNXdejR6il_Vhh5r31PbcenkZkkTgei3Q7atwmVIOLdRPhYj7EwEtS8RX3MCRfjHSBvKfDfw=s512
It can be used to make another sprite move a few steps without using a broadcast message.

Offline

 

#416 2010-10-31 16:11:11

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Welcome to the OLD local block library!

alright then  smile  I've never seen one like that before  tongue  I'll do it now...

COMPLETED

Last edited by sparks (2010-10-31 16:21:23)


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#417 2010-11-01 08:14:27

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: Welcome to the OLD local block library!

I'm relatively new at this, so here's my first block:

Code:

('pi' #r #pi)

Code:

pi
    ^ 3.141592653

Pretty simple, you don't have to add it if you don't want to.


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#418 2010-11-01 12:37:08

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Welcome to the OLD local block library!

Thanks Hardmath123, every block is appreciated! Zorket actually posted that one a few posts up from this, so I'll credit both of you in the library! I look forward to seeing more blocks from you  wink


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#419 2010-11-01 15:38:31

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Welcome to the OLD local block library!

updated graphics thanks again to nXIII:

old title image:
http://i51.tinypic.com/1zokw76.jpg

New title image spans the entire width of the post.
http://dl.dropbox.com/u/6273449/BlockLibraryTitle2.png


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#420 2010-11-01 17:33:38

16Skittles
Scratcher
Registered: 2009-08-26
Posts: 1000+

Re: Welcome to the OLD local block library!

16Skittles wrote:

New scratch blocks!

Clone sprite
Blockspecs:

Code:

('clone me' #- #duplicate)

This is actually by ScratchReallyRocks, I just posted it here first.

Delete sprite

Code:

('delete me' #- #delete)

this one is based on his, but my code.  smile

*cough*


http://16skittles.tk/sig.png
Are you a student? Check out OnSchedule!

Offline

 

#421 2010-11-01 18:40:47

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Welcome to the OLD local block library!

There are already Scratch clone and delete blocks submitted (by several people) but thanks 16Skittles  smile


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#422 2010-11-02 08:17:16

Bobberpi
Scratcher
Registered: 2010-02-12
Posts: 13

Re: Welcome to the OLD local block library!

sparks wrote:

Control
http://i51.tinypic.com/2yvj4w5.jpg
http://dl.dropbox.com/u/6273449/BlockLibDiv2.png
http://www.weebly.com/uploads/4/0/7/6/4 … 710344.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.
http://dl.dropbox.com/u/6273449/BlockLibDiv2.png
http://www.weebly.com/uploads/4/0/7/6/4 … 159808.gif

How do you save the photos?


http://internetometer.com/image/15714.png

Offline

 

#423 2010-11-02 08:55:43

zorket
Scratcher
Registered: 2010-05-25
Posts: 500+

Re: Welcome to the OLD local block library!

*trips* hey, what did I just trip over? *looks down* oh, a block again. This one I made myself.

Blockspec:

('e' #r #giveCircleSecondThing)

Code:

giveCircleSecondThing
^  2.71828183

*trips* hey, what did I just trip over? *looks down* oh, a block again. This one looks like it's by TheGameMaster.

('point to x:%n y:%n' #- #pointToX:y: 10 10)


I've tripped over all these blocks today:
http://scratch.mit.edu/static/projects/sccar3/1296988_med.png
If you want me to show all thier blockspecs and codes, you will see a post getting longer and longer.

Last edited by zorket (2010-11-02 19:34:11)


Marzipan11 must learn to not spoil

Offline

 

#424 2010-11-02 10:20:08

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: Welcome to the OLD local block library!

Code:

('costume center' #r #rotationCenter)

reports costume center


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#425 2010-11-02 17:27:30

16Skittles
Scratcher
Registered: 2009-08-26
Posts: 1000+

Re: Welcome to the OLD local block library!

sparks wrote:

There are already Scratch clone and delete blocks submitted (by several people) but thanks 16Skittles  smile

oh. you should add it to the list of scratch blocks though, that's why I posted them.  wink


http://16skittles.tk/sig.png
Are you a student? Check out OnSchedule!

Offline

 

Board footer