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

#1176 2010-10-06 17:29:20

11-16-01
New Scratcher
Registered: 2010-09-16
Posts: 3

Re: Cool custom blocks in Scratch

the sprite name block is made like this:
go to scriptablescratchmorph go to the control section then put this:

('sprite name' #r #name)

go to instance on the screen that pops up put this:

name
      ^ self objname

Offline

 

#1177 2010-10-06 17:51:51

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

Re: Cool custom blocks in Scratch

11-16-01 wrote:

the sprite name block is made like this:
go to scriptablescratchmorph go to the control section then put this:

('sprite name' #r #name)

go to instance on the screen that pops up put this:

name
      ^ self objname

How'd u figur dat ou?


Marzipan11 must learn to not spoil

Offline

 

#1178 2010-10-08 14:06:19

TheSuccessor
Scratcher
Registered: 2010-04-23
Posts: 1000+

Re: Cool custom blocks in Scratch

11-16-01: is that your D.O.B. !? It would make you another one of our primary school squeakers.


/* No comment */

Offline

 

#1179 2010-10-08 18:14:25

kinker
Scratcher
Registered: 2010-08-01
Posts: 100+

Re: Cool custom blocks in Scratch

rubiks_cube_guy238 wrote:

LS97 wrote:

Hey Scratchers!
Here's a brief list of the different arguments:

#-   no arguments (command or 'stack' block)
#r   Reporter block (the round ones)
#b   boolean block (diamond shaped)
#c   C shaped block (like the forever block)
#t   Time block (like wait X secs)
#W   'when' hat block (obsolete)
#S   start button click hat block
#K   key-activated hat block
#E   event hat block (broadcast)
#s   special form (hard to code)

I happen to be a master of the ScratchProcess*, and can generate C-blocks and S-blocks like any other Scratch block.
Just sayin'.
So, if you have any requests, feel free to ask me.

*ScratchProcess: The ScratchProcess takes care of scripts and C-blocks and S-blocks.

I wnat a do one of these block NOW!


Put in the weirdness: http://i54.tinypic.com/zl6fph.pnghttp://img821.imageshack.us/i/gobanim2.gif/kinker style! [url]http://internetometer.com/image/16724.png[/url]♬♫ 92% of teens have moved on to rap. If you are part of the 8% who still listen to real music, copy and paste this into your signature. ♫♪

Offline

 

#1180 2010-10-09 10:58:45

kinker
Scratcher
Registered: 2010-08-01
Posts: 100+

Re: Cool custom blocks in Scratch

LS97 wrote:

The http://www.freeimagehosting.net/uploads/db8cb97ba8.gifblock
Another request of SeptimusHeap.
Put this code in both Sprite and Stage Morph blockSpecs in the sensing category:

Code:

 ('%s mouse down?' #b #mousePressed: 'left')

then into the instance, into ScriptableScratchMorph, and into 'sensing ops'.
replace the 'mousePressed' code with the one below.

Code:

mousePressed: t1 
    t1 = 'left' ifTrue: [^ Sensor redButtonPressed].
    t1 = 'right' ifTrue: [^ Sensor yellowButtonPressed].
    t1 = 'middle' ifTrue: [^ Sensor blueButtonPressed].
    t1 = 'any' ifTrue: [^ Sensor anyButtonPressed].
    t1 = 'left ' ifTrue: [^ Sensor redButtonPressed].
    t1 = 'right ' ifTrue: [^ Sensor yellowButtonPressed].
    t1 = 'middle ' ifTrue: [^ Sensor blueButtonPressed].
    t1 = 'any ' ifTrue: [^ Sensor anyButtonPressed].
    ^ Sensor redButtonPressed

Then click accept and it should be fine. you'll find the new block in the sensing category. you can put left, right, middle or any into the box and it'll give you the respective sensor button boolean.

i want a dropdown list version of it.


Put in the weirdness: http://i54.tinypic.com/zl6fph.pnghttp://img821.imageshack.us/i/gobanim2.gif/kinker style! [url]http://internetometer.com/image/16724.png[/url]♬♫ 92% of teens have moved on to rap. If you are part of the 8% who still listen to real music, copy and paste this into your signature. ♫♪

Offline

 

#1181 2010-10-09 11:04:26

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Cool custom blocks in Scratch

kinker wrote:

LS97 wrote:

The http://www.freeimagehosting.net/uploads/db8cb97ba8.gifblock
Another request of SeptimusHeap.
Put this code in both Sprite and Stage Morph blockSpecs in the sensing category:

Code:

 ('%s mouse down?' #b #mousePressed: 'left')

then into the instance, into ScriptableScratchMorph, and into 'sensing ops'.
replace the 'mousePressed' code with the one below.

Code:

mousePressed: t1 
    t1 = 'left' ifTrue: [^ Sensor redButtonPressed].
    t1 = 'right' ifTrue: [^ Sensor yellowButtonPressed].
    t1 = 'middle' ifTrue: [^ Sensor blueButtonPressed].
    t1 = 'any' ifTrue: [^ Sensor anyButtonPressed].
    t1 = 'left ' ifTrue: [^ Sensor redButtonPressed].
    t1 = 'right ' ifTrue: [^ Sensor yellowButtonPressed].
    t1 = 'middle ' ifTrue: [^ Sensor blueButtonPressed].
    t1 = 'any ' ifTrue: [^ Sensor anyButtonPressed].
    ^ Sensor redButtonPressed

Then click accept and it should be fine. you'll find the new block in the sensing category. you can put left, right, middle or any into the box and it'll give you the respective sensor button boolean.

i want a dropdown list version of it.

sorry but i'm not accepting any more requests for that i'm fed up in explaining the same thing 100 times over. Find it somewhere, there's about 30 explanations in the forums

Offline

 

#1182 2010-10-09 16:25:51

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

Re: Cool custom blocks in Scratch

Shal I make a new thread with all the blocks in this one and several extra feature tutorials?


You can now reach me on Twitter @johnnydean1_

Offline

 

#1183 2010-10-09 22:30:20

me450
Scratcher
Registered: 2009-03-31
Posts: 56

Re: Cool custom blocks in Scratch

johnnydean1 wrote:

Shal I make a new thread with all the blocks in this one and several extra feature tutorials?

if its fine with you that would be excellent

Offline

 

#1184 2010-10-10 03:57:32

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Cool custom blocks in Scratch

me450 wrote:

johnnydean1 wrote:

Shal I make a new thread with all the blocks in this one and several extra feature tutorials?

if its fine with you that would be excellent

sure -- but fine-tune it a bit please  big_smile

Offline

 

#1185 2010-10-10 09:40:34

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

Re: Cool custom blocks in Scratch

ok, when I get a free second

Last edited by johnnydean1 (2010-10-10 09:40:57)


You can now reach me on Twitter @johnnydean1_

Offline

 

#1186 2010-10-10 13:46:36

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

Re: Cool custom blocks in Scratch

New block! ( (shuffle) (string) )

See the block!

Last edited by zorket (2010-10-10 13:50:12)


Marzipan11 must learn to not spoil

Offline

 

#1187 2010-10-12 05:32:10

me450
Scratcher
Registered: 2009-03-31
Posts: 56

Re: Cool custom blocks in Scratch

kinker wrote:

LS97 wrote:

The http://www.freeimagehosting.net/uploads/db8cb97ba8.gifblock
Another request of SeptimusHeap.
Put this code in both Sprite and Stage Morph blockSpecs in the sensing category:

Code:

 ('%s mouse down?' #b #mousePressed: 'left')

then into the instance, into ScriptableScratchMorph, and into 'sensing ops'.
replace the 'mousePressed' code with the one below.

Code:

mousePressed: t1 
    t1 = 'left' ifTrue: [^ Sensor redButtonPressed].
    t1 = 'right' ifTrue: [^ Sensor yellowButtonPressed].
    t1 = 'middle' ifTrue: [^ Sensor blueButtonPressed].
    t1 = 'any' ifTrue: [^ Sensor anyButtonPressed].
    t1 = 'left ' ifTrue: [^ Sensor redButtonPressed].
    t1 = 'right ' ifTrue: [^ Sensor yellowButtonPressed].
    t1 = 'middle ' ifTrue: [^ Sensor blueButtonPressed].
    t1 = 'any ' ifTrue: [^ Sensor anyButtonPressed].
    ^ Sensor redButtonPressed

Then click accept and it should be fine. you'll find the new block in the sensing category. you can put left, right, middle or any into the box and it'll give you the respective sensor button boolean.

i want a dropdown list version of it.

in other ops in scriptablesprite morphs

Code:

mousePressed: t1 
    t1 = 'left' ifTrue: [^ Sensor redButtonPressed].
    t1 = 'right' ifTrue: [^ Sensor yellowButtonPressed].
    t1 = 'middle' ifTrue: [^ Sensor blueButtonPressed].
    t1 = 'any' ifTrue: [^ Sensor anyButtonPressed].
    t1 = 'left ' ifTrue: [^ Sensor redButtonPressed].
    t1 = 'right ' ifTrue: [^ Sensor yellowButtonPressed].
    t1 = 'middle ' ifTrue: [^ Sensor blueButtonPressed].
    t1 = 'any ' ifTrue: [^ Sensor anyButtonPressed].
    ^ Sensor redButtonPressed

Scratch blocks> commandBlockMorph> all> uncoloredArgMorphFor: add a strip:

Code:

$Z = t2 ifTrue: [^ ChoiceOrExpressionArgMorph new getOptionsSelector: #mouseoptions;
choice: 'left'].

Scratch objects> scriptableScratchMorph> otherOps:

Code:

mouseoptions
    ^ #('left' 'right' 'middle' 'any' 'left ' 'right ' 'middle ' 'any ')

Blockspec - boolean

Code:

('%Z mouse down?' #b #mousePressed:)

Blockspec - reporter

Code:

('%Z mouse down?' #r #mousePressed:)

that should work

Last edited by me450 (2010-10-12 05:38:01)

Offline

 

#1188 2010-10-12 07:46:03

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Cool custom blocks in Scratch

@post above
There's about 7 explanations in this thread only. Thanks for making it really clear though -- I'll link the post to this instead  big_smile

Offline

 

#1189 2010-10-13 02:17:41

me450
Scratcher
Registered: 2009-03-31
Posts: 56

Re: Cool custom blocks in Scratch

LS97 wrote:

@post above
There's about 7 explanations in this thread only. Thanks for making it really clear though -- I'll link the post to this instead  big_smile

thanks

Offline

 

#1190 2010-10-13 04:47:00

SamSamson
New Scratcher
Registered: 2010-09-01
Posts: 42

Re: Cool custom blocks in Scratch

Hmm......

Offline

 

#1191 2010-10-13 15:54:42

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

Re: Cool custom blocks in Scratch

pwiter wrote:

I got a new block
http://img831.imageshack.us/img831/1435/capturesc.jpg
Instance ops:

Code:

| dialogBox |
    dialogBox _ DialogBoxMorph new.
    dialogBox title: t1.
    dialogBox withButtonsForYes: false no: false okay: true cancel: false.
    dialogBox message: t2.
    dialogBox getUserResponse.

Blockspecs

Code:

ho('sw dialog titled %s with contents %s' #- #showDialogTitle:Contents: 'info' 'hello')

Copyright pwitter 2010

Actually, the code is

Code:

showDialogTitle: t1 Contents: t2
  | dialogBox |
    dialogBox _ DialogBoxMorph new.
    dialogBox title: t1.
    dialogBox withButtonsForYes: false no: false okay: true cancel: false.
    dialogBox message: t2.
    dialogBox getUserResponse.

http://dl.dropbox.com/u/6273449/BlockLibDiv2.png
But this does give me an idea for a new block: [close scratch]

Blockspec:

('close scratch' #- #closeUpScratch

Code:

closeUpScratch
  | t1 |
    t1 _ DialogBoxMorph new.
    t1 title: '?'.
    t1 withButtonsForYes: true no: true okay: false cancel: true.
    t1 message: 'Save changes before quitting?'.
    t1 getUserResponse.

But there is a small problem with this block... It doesn't close scratch! I need help!

Last edited by zorket (2010-10-13 16:01:38)


Marzipan11 must learn to not spoil

Offline

 

#1192 2010-10-13 20:38:59

Rune78man50
Scratcher
Registered: 2009-11-29
Posts: 72

Re: Cool custom blocks in Scratch

I'd like a quit scratch block, too.


http://i47.tinypic.com/f56kxz.pngA REAL operating system...

Offline

 

#1193 2010-10-14 00:46:30

Bobsterman
New Scratcher
Registered: 2010-09-01
Posts: 7

Re: Cool custom blocks in Scratch

How could you add more keys to
<key[  ]pressed?>
?


******!!!Don't Worry, Be Happy!!!*****
http://www.thesmilies.com/smilies/happy/jump.gif-----------------------------------------http://www.thesmilies.com/smilies/happy/thumbsup.gif

Offline

 

#1194 2010-10-14 18:30:47

kinker
Scratcher
Registered: 2010-08-01
Posts: 100+

Re: Cool custom blocks in Scratch

me450 wrote:

kinker wrote:

LS97 wrote:

The http://www.freeimagehosting.net/uploads/db8cb97ba8.gifblock
Another request of SeptimusHeap.
Put this code in both Sprite and Stage Morph blockSpecs in the sensing category:

Code:

 ('%s mouse down?' #b #mousePressed: 'left')

then into the instance, into ScriptableScratchMorph, and into 'sensing ops'.
replace the 'mousePressed' code with the one below.

Code:

mousePressed: t1 
    t1 = 'left' ifTrue: [^ Sensor redButtonPressed].
    t1 = 'right' ifTrue: [^ Sensor yellowButtonPressed].
    t1 = 'middle' ifTrue: [^ Sensor blueButtonPressed].
    t1 = 'any' ifTrue: [^ Sensor anyButtonPressed].
    t1 = 'left ' ifTrue: [^ Sensor redButtonPressed].
    t1 = 'right ' ifTrue: [^ Sensor yellowButtonPressed].
    t1 = 'middle ' ifTrue: [^ Sensor blueButtonPressed].
    t1 = 'any ' ifTrue: [^ Sensor anyButtonPressed].
    ^ Sensor redButtonPressed

Then click accept and it should be fine. you'll find the new block in the sensing category. you can put left, right, middle or any into the box and it'll give you the respective sensor button boolean.

i want a dropdown list version of it.

in other ops in scriptablesprite morphs

Code:

mousePressed: t1 
    t1 = 'left' ifTrue: [^ Sensor redButtonPressed].
    t1 = 'right' ifTrue: [^ Sensor yellowButtonPressed].
    t1 = 'middle' ifTrue: [^ Sensor blueButtonPressed].
    t1 = 'any' ifTrue: [^ Sensor anyButtonPressed].
    t1 = 'left ' ifTrue: [^ Sensor redButtonPressed].
    t1 = 'right ' ifTrue: [^ Sensor yellowButtonPressed].
    t1 = 'middle ' ifTrue: [^ Sensor blueButtonPressed].
    t1 = 'any ' ifTrue: [^ Sensor anyButtonPressed].
    ^ Sensor redButtonPressed

Scratch blocks> commandBlockMorph> all> uncoloredArgMorphFor: add a strip:

Code:

$Z = t2 ifTrue: [^ ChoiceOrExpressionArgMorph new getOptionsSelector: #mouseoptions;
choice: 'left'].

Scratch objects> scriptableScratchMorph> otherOps:

Code:

mouseoptions
    ^ #('left' 'right' 'middle' 'any' 'left ' 'right ' 'middle ' 'any ')

Blockspec - boolean

Code:

('%Z mouse down?' #b #mousePressed:)

Blockspec - reporter

Code:

('%Z mouse down?' #r #mousePressed:)

that should work

Thanks!


Put in the weirdness: http://i54.tinypic.com/zl6fph.pnghttp://img821.imageshack.us/i/gobanim2.gif/kinker style! [url]http://internetometer.com/image/16724.png[/url]♬♫ 92% of teens have moved on to rap. If you are part of the 8% who still listen to real music, copy and paste this into your signature. ♫♪

Offline

 

#1195 2010-10-15 00:13:31

Bobsterman
New Scratcher
Registered: 2010-09-01
Posts: 7

Re: Cool custom blocks in Scratch

How would you/what is the code for adding more code to the

           <key[  ]pressed?>

???


******!!!Don't Worry, Be Happy!!!*****
http://www.thesmilies.com/smilies/happy/jump.gif-----------------------------------------http://www.thesmilies.com/smilies/happy/thumbsup.gif

Offline

 

#1196 2010-10-15 10:23:10

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Cool custom blocks in Scratch

Bobsterman wrote:

How would you/what is the code for adding more code to the

           <key[  ]pressed?>

???

to add key names use the keyNames method, to define those keyNames use the asciiFor: method (you need to know the ascii code for it though)

Offline

 

#1197 2010-10-15 10:24:17

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Cool custom blocks in Scratch

zorket wrote:

But there is a small problem with this block... It doesn't close scratch! I need help!

LOL. there is no code to quit scratch in there.

use ScratchFrameMorph quitScratch or whatever it's called to do so  smile

Offline

 

#1198 2010-10-15 10:33:38

TheSuccessor
Scratcher
Registered: 2010-04-23
Posts: 1000+

Re: Cool custom blocks in Scratch

Smalltalk snapshot: false andQuit: true

I HATE the 60s rule.


/* No comment */

Offline

 

#1199 2010-10-15 12:21:56

bbbeb
Scratcher
Registered: 2009-06-11
Posts: 1000+

Re: Cool custom blocks in Scratch

TheSuccessor wrote:

Smalltalk snapshot: false andQuit: true

I HATE the 60s rule.

DO NOT do this.

It does not save.

Use #quitScratch instead.


Back in my day.... there were no laws that censored the internet... now, there are.... nah.

Offline

 

#1200 2010-10-15 12:26:09

TheSuccessor
Scratcher
Registered: 2010-04-23
Posts: 1000+

Re: Cool custom blocks in Scratch

Whoops... I knew that, i just didn't see zorket's post.


/* No comment */

Offline

 

Board footer