cool! sparks! can you do a write() block?
Offline
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
Offline
Oops! Accidently opened a closet of blocks.
(pi) operators by zorket
blockspec:
('pi' #r #getPi
getPi ^ 3.141592653
( (color) effect) looks by ls97
blockspec:
('%g effect' #r #getEffect: 'color')
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)
Offline
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 saveScratchProjectWhat 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
#pressGreenFlagButtonWhat 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].
^ falseWhat 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].
^ 0Code (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
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>? Shared by Marioblender (requested by hpotter134, coded by ScratchReallyROCKS)
method:
move: sprite forward: distance sprite forward: distance
spec:
('make %m move %n steps' #- #move:forward:)
Offline
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
Offline
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
Offline
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)
Offline
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
sparks, I tested the block already and here is the picture:
It can be used to make another sprite move a few steps without using a broadcast message.
Offline
I'm relatively new at this, so here's my first block:
('pi' #r #pi)
pi ^ 3.141592653
Pretty simple, you don't have to add it if you don't want to.
Offline
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
Offline
16Skittles wrote:
New scratch blocks!
Clone sprite
Blockspecs:Code:
('clone me' #- #duplicate)This is actually by ScratchReallyRocks, I just posted it here first.
Delete spriteCode:
('delete me' #- #delete)this one is based on his, but my code.
*cough*
Offline
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?
Offline
*trips* hey, what did I just trip over? *looks down* oh, a block again. This one I made myself.
Blockspec:
('e' #r #giveCircleSecondThing)
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:
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)
Offline
('costume center' #r #rotationCenter)
reports costume center
Offline
sparks wrote:
There are already Scratch clone and delete blocks submitted (by several people) but thanks 16Skittles
oh. you should add it to the list of scratch blocks though, that's why I posted them.
Offline