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

#1 2010-04-09 10:58:56

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

New Blocks Code

Recently there has been alot of talk of new blocks.

In this topic, I just want a list of the code for the new blocks and the name of them.

Ill start.

Code:

Name of block: Take Picture From Camera

Block Code:
('take photo' #- #takePhoto)

Other Notes:
NO OTHER NOTES

Code:

Name of block: Clone Current Sprite

Block Code:
('clone this sprite' #- #duplicateNoAttach)

Other Notes:
Does not work in presentation mode.

Code:

Name of block: Delete Current Sprite

Block Code:
('delete this sprite' #- #undoableDeleteSprite)

Other Notes:
Does not work in presentation mode.

Code:

Name of Block: Paint Costume
Thanks to: MathsWizz

Block Code:
('paint costume' #- #drawNewCostume)

Other Notes:
NO OTHER NOTES

Code:

Name of Block: Any Key Pressed
Thanks to: nXIII

Block Code:
('key pressed' #r #keyPressed)

Instance:
keyPressed
    "Answer the currently pressed key."

    self keyNames do: [:ch |
        (self keyPressed: ch) ifTrue: [^ ch]].
    ^ ''.
Other Notes:
NO OTHER NOTES

Code:

Name of Block: Enter Presentation Mode
Thanks to: nXIII

Block Code:
('enter presentation mode' #- #enterPresMode)

Instance:
enterPresMode
|t1|
t1 := self ownerThatIsA: ScratchFrameMorph.
t1 enterPresentationMode

Other Notes:
NO OTHER NOTES

Code:

Name of Block: Open URL
Thanks to: billyedward

Block Code:
('Open a browser with URL%s' #- #openWebBrowserOn: 'http://www.')

Instance:
openWebBrowserOn: t1 
    Cursor wait showWhile: [ScratchPlugin primOpenURL: t1]

Other Notes:
NO OTHER NOTES

Code:

 Name of Block: Hidden?
Thanks to: TheGameMaster

Block Code:
('hidden?' #b #isHidden)

Other Notes:
NO OTHER NOTES

Code:

 Name of Block: Point Towards X Y
Thanks to: TheGameMaster

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

Other Notes:
NO OTHER NOTES

Code:

Name of Block: Record Sound
Thanks to: GirWaffles64

Block Code:
('record sound' #- #recordSound)

Other Notes:
NO OTHER NOTES

Code:

Name of Block: Attach to Sprite
Thanks to: electrified123

Block Code:
('attach%m' #- #attachSprite:)

Instance:
 attachSprite: t1 
self addMorph: t1 


Other Notes:
NO OTHER NOTES

Code:

Name of Block: Detach
Thanks to: NXIII

Block Code:
('detach %m' #- #detachMe)

Instance:
detachMe

    | par |
    par _ self owner owner.
    (self owner isKindOf: ScratchStageMorph) ifTrue: [^ self].
    self delete.
    par addMorph: self.

Other Notes:
NO OTHER NOTES

Code:

Name of Block: Error
Thanks to: meew0

Block Code:
('error with message %s' #- #errorMessage: 'an error')

Instance:
errorMessage: t1
 self error: t1

Other Notes: 
Works only if error catching is off!

Code:

Name of Block: join [] with [] and [] and []
Thanks to: meew0

Block Code:
('join %s with %s and %s and %s' #r #concatenate:with:and:and: '' '' '' '')

Instance:
concatenate: t1 with: t2 and: t3 and: t4 
    | t5 t6 |
    t5 _ t1 asString , t2 asString.
    t6 _ t3 asString , t4 asString.
    ^ t5 asString asUTF8 , t6 asString asUTF8

Other Notes: 
NO OTHER NOTES

Code:

Name of Block: enable programmer facilities
Thanks to: Zorbak42

Block Code:
('enable programmer facilities' #- #enableProgrammerFacilities)

Instance:
enableProgrammerFacilities
    Preferences enableProgrammerFacilities

Other Notes:
Let's you middle click/alt click on things in Scratch and get the

Code:

Name of Block: save image and close Scratch
Thanks to: Zorbak42

Block Code:
('save image and close Scratch' #- #saveImage)

Instance:
saveImage
    ScratchFrameMorph new openInWorld; saveImageForEndUser

Other Notes:
Saves the Scratch.image and closes Scratch.

Last edited by johnnydean1 (2010-05-03 07:25:30)


You can now reach me on Twitter @johnnydean1_

Offline

 

#2 2010-04-09 12:28:28

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

Re: New Blocks Code

as these blocks will all be avaliable in http://pantherprogramming.weebly.com Panther, people can just wait a few days for it's release.

Last edited by sparks (2010-04-09 12:30:48)


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

Offline

 

#3 2010-04-09 12:32:41

technoguyx
Scratcher
Registered: 2008-10-18
Posts: 1000+

Re: New Blocks Code

Hmmm, I wonder if you would show the result of the take photo block in a costume... If not, then it's useless.  tongue


http://getgnulinux.org/links/en/linuxliberated_4_78x116.png

Offline

 

#4 2010-04-09 14:02:13

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: New Blocks Code

Yes technpguyx it does


You can now reach me on Twitter @johnnydean1_

Offline

 

#5 2010-04-09 14:41:25

rocket101
Scratcher
Registered: 2009-08-21
Posts: 500+

Re: New Blocks Code

The camera block is so cool!

Offline

 

#6 2010-04-09 14:49:21

TheGameMaster1231
Scratcher
Registered: 2009-07-24
Posts: 1000+

Re: New Blocks Code

I Knew About The Clone Sprite And Delete Sprite Blocks, But I Had No Idea You Could Do A Take Picture Block! And If You Take A Picture, Your Picture Is Automaticly The Costume! But It Stops All The Scripts, So It's Pretty Much Useless.  hmm

Offline

 

#7 2010-04-09 16:49:01

Billybob-Mario
Scratcher
Registered: 2008-01-05
Posts: 500+

Re: New Blocks Code

What is the new costume message? a.k.a. ('new costume' #- #paintCostume) or something like that.

Offline

 

#8 2010-04-09 17:02:30

MathWizz
Scratcher
Registered: 2009-08-31
Posts: 1000+

Re: New Blocks Code

Billybob-Mario wrote:

What is the new costume message? a.k.a. ('new costume' #- #paintCostume) or something like that.

It's "('paint costume' #- #drawNewCostume)"


http://block.site90.net/scratch.mit/text.php?size=30&text=%20A%20signature!&color=333333

Offline

 

#9 2010-04-10 06:57:50

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: New Blocks Code

Added New Blocks


You can now reach me on Twitter @johnnydean1_

Offline

 

#10 2010-04-10 10:44:35

TheGameMaster1231
Scratcher
Registered: 2009-07-24
Posts: 1000+

Re: New Blocks Code

Add My <hidden?> Block And My point to x: () y: () Blocks. You Can Find Them In My Block Tutorial Projects.  big_smile

Offline

 

#11 2010-04-10 14:03:48

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: New Blocks Code

Ok will do...


You can now reach me on Twitter @johnnydean1_

Offline

 

#12 2010-04-11 13:59:45

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: New Blocks Code

Added Even More Blocks


You can now reach me on Twitter @johnnydean1_

Offline

 

#13 2010-04-13 03:39:19

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: New Blocks Code

Ok quite a few blocks now


You can now reach me on Twitter @johnnydean1_

Offline

 

#14 2010-04-28 16:17:00

electrified123
Scratcher
Registered: 2009-11-22
Posts: 100+

Re: New Blocks Code

by: electrified123


SPRITE MORPH ONLY code:  attachSprite: t1
self addMorph: t1





blockspec: ('attach%m' #- #attachSprite:)

makes the sprite attach to the selected sprite , i am working on an unattach from sprite block but i havent figured it out yet


http://i47.tinypic.com/5nrzmp.jpg check out my stuff ~ If You Really Thought i would think what you thought, than you must think i think what you thought i would think at the time you thought i was thinking what you thought

Offline

 

#15 2010-04-28 17:55:56

AmoebaMan
Scratcher
Registered: 2009-01-26
Posts: 500+

Re: New Blocks Code

you should add the place to put the instance.  the keypressed block threw me off for a while because I couldn't figure out what was wrong with the instance.  then i realized there were two places for sensing ops.


http://i942.photobucket.com/albums/ad269/RyanScathe/AmoebaMan.png

Offline

 

#16 2010-04-28 19:46:51

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

Re: New Blocks Code

electrified123 wrote:

by: electrified123


SPRITE MORPH ONLY code:  attachSprite: t1
self addMorph: t1





blockspec: ('attach%m' #- #attachSprite:)

makes the sprite attach to the selected sprite , i am working on an unattach from sprite block but i havent figured it out yet

I've done detachMe.

detachMe

    | par |
    par _ self owner owner.
    (self owner isKindOf: ScratchStageMorph) ifTrue: [^ self].
    self delete.
    par addMorph: self.

Last edited by nXIII (2010-04-28 19:52:21)


nXIII

Offline

 

#17 2010-04-29 02:58:58

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: New Blocks Code

Thx will add soon


You can now reach me on Twitter @johnnydean1_

Offline

 

#18 2010-04-30 10:04:11

electrified123
Scratcher
Registered: 2009-11-22
Posts: 100+

Re: New Blocks Code

I've done detachMe.
    i tried it out but when you attach to another sprite that sprite dissappears in the detach menu


http://i47.tinypic.com/5nrzmp.jpg check out my stuff ~ If You Really Thought i would think what you thought, than you must think i think what you thought i would think at the time you thought i was thinking what you thought

Offline

 

#19 2010-04-30 10:52:50

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: New Blocks Code

No you do not need a dropdown menu!


You can now reach me on Twitter @johnnydean1_

Offline

 

#20 2010-04-30 17:21:32

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

Re: New Blocks Code

electrified123 wrote:

I've done detachMe.
    i tried it out but when you attach to another sprite that sprite dissappears in the detach menu

do you mean the 'Attach' menu? If so, that should happen, because you can't attach a sprite to two sprites at once.


nXIII

Offline

 

#21 2010-05-01 07:09:24

electrified123
Scratcher
Registered: 2009-11-22
Posts: 100+

Re: New Blocks Code

nXIII wrote:

electrified123 wrote:

I've done detachMe.
    i tried it out but when you attach to another sprite that sprite dissappears in the detach menu

do you mean the 'Attach' menu? If so, that should happen, because you can't attach a sprite to two sprites at once.

no the sprite you attach to disappears in the detach menu


http://i47.tinypic.com/5nrzmp.jpg check out my stuff ~ If You Really Thought i would think what you thought, than you must think i think what you thought i would think at the time you thought i was thinking what you thought

Offline

 

#22 2010-05-01 07:21:30

meew0
Scratcher
Registered: 2010-02-22
Posts: 1000+

Re: New Blocks Code

You could add my first block:

Code:

Name of Block: join [] with [] and [] and []
Thanks to: meew0

Block Code:
('join %s with %s and %s and %s' #r #concatenate:with:and:and: '' '' '' '')

Instance:
concatenate: t1 with: t2 and: t3 and: t4 
    | t5 t6 |
    t5 _ t1 asString , t2 asString.
    t6 _ t3 asString , t4 asString.
    ^ t5 asString asUTF8 , t6 asString asUTF8

Other Notes: 
NO OTHER NOTES

http://i.imgur.com/mJV3j.pnghttp://i.imgur.com/HwWAX.pnghttp://i.imgur.com/sZ7Ui.pnghttp://i.imgur.com/0y6yh.pnghttp://i.imgur.com/nOC4l.png

Offline

 

#23 2010-05-01 08:24:01

markyparky56
Scratcher
Registered: 2008-03-20
Posts: 1000+

Re: New Blocks Code

meew0 wrote:

You could add my first block:

Code:

Name of Block: join [] with [] and [] and []
Thanks to: meew0

Block Code:
('join %s with %s and %s and %s' #r #concatenate:with:and:and: '' '' '' '')

Instance:
concatenate: t1 with: t2 and: t3 and: t4 
    | t5 t6 |
    t5 _ t1 asString , t2 asString.
    t6 _ t3 asString , t4 asString.
    ^ t5 asString asUTF8 , t6 asString asUTF8

Other Notes: 
NO OTHER NOTES

Whats the point when you can just keep pilling the other join blocks into each other?

http://img222.imageshack.us/img222/4382/multijoin.gif


http://j.mp/jgVnTq
Check out my game engine development site: NewDawn I'm a Level 171 Scratcher.I am http://bit.ly/nkvLNT

Offline

 

#24 2010-05-01 08:51:22

meew0
Scratcher
Registered: 2010-02-22
Posts: 1000+

Re: New Blocks Code

The block is
1. easier to use
2. smaller

and 3. just my first block.


http://i.imgur.com/mJV3j.pnghttp://i.imgur.com/HwWAX.pnghttp://i.imgur.com/sZ7Ui.pnghttp://i.imgur.com/0y6yh.pnghttp://i.imgur.com/nOC4l.png

Offline

 

#25 2010-05-02 20:06:45

Zorbak42
Scratcher
Registered: 2009-01-27
Posts: 100+

Re: New Blocks Code

Here's a few from me

Code:

Name of Block: enable programmer facilities
Thanks to: Zorbak42

Block Code:
('enable programmer facilities' #- #enableProgrammerFacilities)

Instance:
enableProgrammerFacilities
    Preferences enableProgrammerFacilities

Other Notes:
Let's you middle click/alt click on things in Scratch and get the menu, duplicate, drag, delete, ect. buttons.

and

Code:

Name of Block: save image and close Scratch
Thanks to: Zorbak42

Block Code:
('save image and close Scratch' #- #saveImage)

Instance:
saveImage
    ScratchFrameMorph new openInWorld; saveImageForEndUser

Other Notes:
Saves the Scratch.image and closes Scratch.

Last edited by Zorbak42 (2010-05-02 20:07:19)

Offline

 

Board footer