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

#126 2010-04-29 11:06:42

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

Re: Cool custom blocks in Scratch

Joeman592 wrote:

Im making my own scratch-based project, and i need some blocks. could you please give me te codes for a <I recieve[^]> conrtrol booolean, a bounce, if touching [^], bounce motion blocks, Think nothing and change costume # by () look blocks, and if you can do thats THANK YOU SOOOOOO MUCH!!!!

you can use the bingo source code when it's released if you know how to wait, or try to figure it out yourself (i suggest you do, i'm not being selfish, it's just that you can WAY better at squeak if you experiment with putting different bits of code together).

Offline

 

#127 2010-04-29 11:28:58

randalpik
Scratcher
Registered: 2008-07-27
Posts: 82

Re: Cool custom blocks in Scratch

LS97 wrote:

randalpik wrote:

LS97 wrote:


easy. first take out some script in Squeak which automatically fixes it to the current layout, then alt-click buttons and click duplicate. then change the string and the arguments to the new block category.

But where is the script?

aaargh! i **** hate my internet connection!!!!!! i have to REPOST!!! I AM MAD AT IT!!! ARGHHHH!!!!!

GO TO: scratch-ui-panes > viewermorph > initialization > rebuildcategories

delete it and click 'delete, then browse senders'. in the senders delete the section of code referred to the rebuildcategories.

note: to add blocks to yur new category, just add the name in quotes somewhere in the blockSpecs, then under the scratchMorph blockSpecs go to blockSpecsColor or something like that and add your desired color (unless you want red then it's automatic).

haha i copied the text now even if it disconnects...

Wait... I can't change the arguments so that it works... it gives me an error


My stuff: http://scratch.mit.edu/users/randalpik
Your face: Look at a gopher

Offline

 

#128 2010-04-29 13:24:07

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

Re: Cool custom blocks in Scratch

randalpik wrote:

Wait... I can't change the arguments so that it works... it gives me an error

it didn't to me.. could you post those arguments so that i can figure out what's wrong?

Offline

 

#129 2010-04-29 14:16:15

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

Re: Cool custom blocks in Scratch

Hey, i was looking at the new user block catagories on the bingo website, what is World?


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

 

#130 2010-04-29 14:54:04

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

Re: Cool custom blocks in Scratch

markyparky56 wrote:

Hey, i was looking at the new user block catagories on the bingo website, what is World?

world category is stuff that has to do with the outside world (duh). here's a list of some stuff i put:

- link to website/program
- check connection
- moved sliders from sensing
- tooltip [something]
- <confirm [Sure?]>
- get date/time/weekday/etc
- record sound
- take picture
- show dialog titled [] with [] as contents

that's pretty much everything i came up with till now.

Offline

 

#131 2010-04-29 14:56:24

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

Re: Cool custom blocks in Scratch

poppypaynterscratch wrote:

could i join bingo? im *sortof* working on a personal mod.... but i'd rather trash it and work on bingo... im (obviously) familiar with the browser and such... so, could i hepl work on it?

yeah sure you can! submit your entry to the bingo forums' main page and put in your email there (no one apart from me can see it) and i'll get back to you by email asap.

Offline

 

#132 2010-04-29 15:00:17

waveOSBeta
Scratcher
Registered: 2009-12-08
Posts: 1000+

Re: Cool custom blocks in Scratch

What's changed in the Paint Editor Screenshot?


http://internetometer.com/image/10202.png]
New signature coming soon!  smile

Offline

 

#133 2010-04-29 16:09:31

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

Re: Cool custom blocks in Scratch

Can you please make the blocks featured here:
http://scratch.mit.edu/projects/sparks/745619


You can now reach me on Twitter @johnnydean1_

Offline

 

#134 2010-04-29 18:22:51

urhungry
Scratcher
Registered: 2009-07-03
Posts: 1000+

Re: Cool custom blocks in Scratch

How do you add more block categories? It's really usefull.

Offline

 

#135 2010-04-29 19:39:23

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

Re: Cool custom blocks in Scratch

urhungry wrote:

How do you add more block categories? It's really usefull.

As if I haven't answered this question at least ten times.


nXIII

Offline

 

#136 2010-04-29 20:00:36

Sparkyasa
Scratcher
Registered: 2008-06-27
Posts: 24

Re: Cool custom blocks in Scratch

LS97 wrote:

waveOSBeta wrote:

Can you please add more blocks, LS97?

Yeah sure, i'm just trying to figure out a certain block without success. i'll get on with the other ones and it might come to me.

What is that block?


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

Offline

 

#137 2010-04-29 20:38:42

urhungry
Scratcher
Registered: 2009-07-03
Posts: 1000+

Re: Cool custom blocks in Scratch

nXIII wrote:

urhungry wrote:

How do you add more block categories? It's really usefull.

As if I haven't answered this question at least ten times.

where did you?

Offline

 

#138 2010-04-29 21:40:06

Joeman592
Scratcher
Registered: 2010-01-23
Posts: 100+

Re: Cool custom blocks in Scratch

Zorbak42 wrote:

Joeman592 wrote:

Im making my own scratch-based project, and i need some blocks. could you please give me te codes for a <I recieve[^]> conrtrol booolean, a bounce, if touching [^], bounce motion blocks, Think nothing and change costume # by () look blocks, and if you can do thats THANK YOU SOOOOOO MUCH!!!!

I can give you code for change costume # by (). Put

Code:

changeCostumeIndexBy: t1 
    self costumeIndex: self costumeIndex + t1

in looks ops of ScriptableScratchMorph instance,

Code:

('change costume by %n' #- #changeCostumeIndexBy: 1)

in SpriteMorph blockSpecs, and

Code:

('change background by %n' #- #changeBackgroundIndexBy: 1)

in StageMorph blockSpecs. Hope it helps!  smile

THANK YOU SOOOOOOOO MUCH!


http://i.imgur.com/HcAj1.png
http://i.imgur.com/gss7S.gifhttp://i.imgur.com/kbcKt.gifhttp://i.imgur.com/0LteM.gif

Offline

 

#139 2010-04-29 22:59:03

Joeman592
Scratcher
Registered: 2010-01-23
Posts: 100+

Re: Cool custom blocks in Scratch

LS97 wrote:

The key_pressed reporter block
a great block that saves you the fuss of making 30 scripts for each different key. just add this to a forever if and youre done with your scripting for a text program! add the block wherever you want, and add this code into the corresponding instance ops.

Code:

    (Sensor keyPressed: 65)
        ifTrue: [^ 'a'].
    (Sensor keyPressed: 66)
        ifTrue: [^ 'b'].
    (Sensor keyPressed: 67)
        ifTrue: [^ 'c'].
    (Sensor keyPressed: 68)
        ifTrue: [^ 'd'].
    (Sensor keyPressed: 69)
        ifTrue: [^ 'e'].
    (Sensor keyPressed: 70)
        ifTrue: [^ 'f'].
    (Sensor keyPressed: 71)
        ifTrue: [^ 'g'].
    (Sensor keyPressed: 72)
        ifTrue: [^ 'h'].
    (Sensor keyPressed: 73)
        ifTrue: [^ 'i'].
    (Sensor keyPressed: 74)
        ifTrue: [^ 'j'].
    (Sensor keyPressed: 75)
        ifTrue: [^ 'k'].
    (Sensor keyPressed: 76)
        ifTrue: [^ 'l'].
    (Sensor keyPressed: 77)
        ifTrue: [^ 'm'].
    (Sensor keyPressed: 78)
        ifTrue: [^ 'n'].
    (Sensor keyPressed: 79)
        ifTrue: [^ 'o'].
    (Sensor keyPressed: 80)
        ifTrue: [^ 'p'].
    (Sensor keyPressed: 81)
        ifTrue: [^ 'q'].
    (Sensor keyPressed: 82)
        ifTrue: [^ 'r'].
    (Sensor keyPressed: 83)
        ifTrue: [^ 's'].
    (Sensor keyPressed: 84)
        ifTrue: [^ 't'].
    (Sensor keyPressed: 85)
        ifTrue: [^ 'u'].
    (Sensor keyPressed: 86)
        ifTrue: [^ 'v'].
    (Sensor keyPressed: 87)
        ifTrue: [^ 'w'].
    (Sensor keyPressed: 88)
        ifTrue: [^ 'x'].
    (Sensor keyPressed: 89)
        ifTrue: [^ 'y'].
    (Sensor keyPressed: 90)
        ifTrue: [^ 'z'].
    (Sensor keyPressed: 32)
        ifTrue: [^ 'space'].
    (Sensor keyPressed: 1)
        ifTrue: [^ 'home'].
    (Sensor keyPressed: 4)
        ifTrue: [^ 'end'].
    (Sensor keyPressed: 5)
        ifTrue: [^ 'insert'].
    (Sensor keyPressed: 9)
        ifTrue: [^ 'tab'].
    (Sensor keyPressed: 11)
        ifTrue: [^ 'page up'].
    (Sensor keyPressed: 12)
        ifTrue: [^ 'page down'].
    (Sensor keyPressed: 127)
        ifTrue: [^ 'delete'].
    ^ 'none'

Pretty long eh? don't be discouraged it's worth it!

It didnt work for me... also, shouldnt the blockspec be a boolean instead of a reporter?


http://i.imgur.com/HcAj1.png
http://i.imgur.com/gss7S.gifhttp://i.imgur.com/kbcKt.gifhttp://i.imgur.com/0LteM.gif

Offline

 

#140 2010-04-29 23:26:36

Joeman592
Scratcher
Registered: 2010-01-23
Posts: 100+

Re: Cool custom blocks in Scratch

Joeman592 wrote:

Im making my own scratch-based project, and i need some blocks. could you please give me te codes for a <I recieve[^]> conrtrol booolean, a bounce, if touching [^], bounce motion blocks, Think nothing and change costume # by () look blocks, and if you can do thats THANK YOU SOOOOOO MUCH!!!!

I have the change costume # by (), can someone please give me the oithers? I'll give you credit!


http://i.imgur.com/HcAj1.png
http://i.imgur.com/gss7S.gifhttp://i.imgur.com/kbcKt.gifhttp://i.imgur.com/0LteM.gif

Offline

 

#141 2010-04-30 07:38:14

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

Re: Cool custom blocks in Scratch

Joeman592 wrote:

Zorbak42 wrote:

Joeman592 wrote:

Im making my own scratch-based project, and i need some blocks. could you please give me te codes for a <I recieve[^]> conrtrol booolean, a bounce, if touching [^], bounce motion blocks, Think nothing and change costume # by () look blocks, and if you can do thats THANK YOU SOOOOOO MUCH!!!!

I can give you code for change costume # by (). Put

Code:

changeCostumeIndexBy: t1 
    self costumeIndex: self costumeIndex + t1

in looks ops of ScriptableScratchMorph instance,

Code:

('change costume by %n' #- #changeCostumeIndexBy: 1)

in SpriteMorph blockSpecs, and

Code:

('change background by %n' #- #changeBackgroundIndexBy: 1)

in StageMorph blockSpecs. Hope it helps!  smile

THANK YOU SOOOOOOOO MUCH!

You're welcome.  smile  I've heard the I receive block is impossible to make, I'm not sure if this is true, but I don't think anyone has it.  sad  I'll try to make a bounce block now... ...Almost got it. An error message appeared saying t1 and t2 are undefined or something.  sad 

Code:

bounce
    | t1 t2 t3 t4 |
    t3 _ self rotationDegrees degreesToRadians cos.
    t4 _ self rotationDegrees degreesToRadians sin negated.
    t1 left < t2 left ifTrue: [t3 _ t3 abs].
    t1 right > t2 right ifTrue: [t3 _ t3 abs negated].
    t1 top < t2 top ifTrue: [t4 _ t4 abs negated].
    t1 bottom > t2 bottom ifTrue: [t4 _ t4 abs].
    self rotationDegrees: (t4 negated asFloat arcTan: t3) radiansToDegrees.
    self position: self position + (t1 amountToTranslateWithin: t2)

If you find out what's wrong, please let me know. Bounce, if touching, if I can figure out what's wrong with bounce, I might be able to do that. Think nothing, you can just use the say nothing, it will stop what it's thinking too.

Code:

('say nothing' #- #sayNothing)

smile

Offline

 

#142 2010-04-30 07:41:31

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

Re: Cool custom blocks in Scratch

urhungry wrote:

nXIII wrote:

urhungry wrote:

How do you add more block categories? It's really usefull.

As if I haven't answered this question at least ten times.

where did you?

On the previous page of this thread.

aaargh! i **** hate my internet connection!!!!!! i have to REPOST!!! I AM MAD AT IT!!! ARGHHHH!!!!!

GO TO: scratch-ui-panes > viewermorph > initialization > rebuildcategories

delete it and click 'delete, then browse senders'. in the senders delete the section of code referred to the rebuildcategories.

note: to add blocks to yur new category, just add the name in quotes somewhere in the blockSpecs, then under the scratchMorph blockSpecs go to blockSpecsColor or something like that and add your desired color (unless you want red then it's automatic).

haha i copied the text now even if it disconnects...

EDIT: That wasn't nXIII, I don't know where he answered it.

Last edited by Zorbak42 (2010-04-30 07:45:11)

Offline

 

#143 2010-04-30 07:46:17

Sparkyasa
Scratcher
Registered: 2008-06-27
Posts: 24

Re: Cool custom blocks in Scratch

randalpik wrote:

LS97 wrote:

The link block
Ok, finally some time to add the greatest block of all. the block links the user to a webpage, program or file as long as the path  or URL is given. add in the blockspecs in the control section some kind of block code (choose whatever you want, you know how to do it). and add in the corresponding instance ops:

Code:

    Cursor wait showWhile: [ScratchPlugin primOpenURL: t1]

So little code for such a great block... and remember to click accept!

For people who aren't sure how to put this in the block specs, here's a good way:

Code:

 ('go to website %s' #- #getLink: 'http://scratch.mit.edu/')

The result will be a block that says "go to website [http://scratch.mit.edu/]" wherein scratch.mit.edu is what it says by default.

Where should I put it?


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

Offline

 

#144 2010-04-30 07:51:56

Sparkyasa
Scratcher
Registered: 2008-06-27
Posts: 24

Re: Cool custom blocks in Scratch

Zorbak42 wrote:

Joeman592 wrote:

Zorbak42 wrote:


I can give you code for change costume # by (). Put

Code:

changeCostumeIndexBy: t1 
    self costumeIndex: self costumeIndex + t1

in looks ops of ScriptableScratchMorph instance,

Code:

('change costume by %n' #- #changeCostumeIndexBy: 1)

in SpriteMorph blockSpecs, and

Code:

('change background by %n' #- #changeBackgroundIndexBy: 1)

in StageMorph blockSpecs. Hope it helps!  smile

THANK YOU SOOOOOOOO MUCH!

You're welcome.  smile  I've heard the I receive block is impossible to make, I'm not sure if this is true, but I don't think anyone has it.  sad  I'll try to make a bounce block now... ...Almost got it. An error message appeared saying t1 and t2 are undefined or something.  sad 

Code:

bounce
    | t1 t2 t3 t4 |
    t3 _ self rotationDegrees degreesToRadians cos.
    t4 _ self rotationDegrees degreesToRadians sin negated.
    t1 left < t2 left ifTrue: [t3 _ t3 abs].
    t1 right > t2 right ifTrue: [t3 _ t3 abs negated].
    t1 top < t2 top ifTrue: [t4 _ t4 abs negated].
    t1 bottom > t2 bottom ifTrue: [t4 _ t4 abs].
    self rotationDegrees: (t4 negated asFloat arcTan: t3) radiansToDegrees.
    self position: self position + (t1 amountToTranslateWithin: t2)

If you find out what's wrong, please let me know. Bounce, if touching, if I can figure out what's wrong with bounce, I might be able to do that. Think nothing, you can just use the say nothing, it will stop what it's thinking too.

Code:

('say nothing' #- #sayNothing)

smile

You're right that the <when i receive[message\/]> would be impossible, but I think [wait until I receive [message\/]] would be possible.


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

Offline

 

#145 2010-04-30 08:33:06

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

Re: Cool custom blocks in Scratch

LS97 wrote:

markyparky56 wrote:

Hey, i was looking at the new user block catagories on the bingo website, what is World?

world category is stuff that has to do with the outside world (duh). here's a list of some stuff i put:

- link to website/program
- check connection
- moved sliders from sensing
- tooltip [something]
- <confirm [Sure?]>
- get date/time/weekday/etc
- record sound
- take picture
- show dialog titled [] with [] as contents

that's pretty much everything i came up with till now.

Ah... ok.


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

 

#146 2010-04-30 11:23:48

randalpik
Scratcher
Registered: 2008-07-27
Posts: 82

Re: Cool custom blocks in Scratch

LS97 wrote:

randalpik wrote:

Wait... I can't change the arguments so that it works... it gives me an error

it didn't to me.. could you post those arguments so that i can figure out what's wrong?

Ok... so I got rid of the scripts that you said to, and then I alt-clicked the button to duplicate. I alt-clicked on the new button, clicked "change arguments", typed in "dialogs" (that's what I wanted) but the text didn't change. I tried to do that by alt-clicking again and clicking "change label". It gave me this error:

Message not understood: asText

StringMorph(Object)>>error:
StringMorph(Object)>>doesNotUnderstand:
TextMorphForEditView(TextMorph)>>newContents:
TextMorphForEditView(TextMorph)>>contents:wrappedTo:
PluggableTextMorph>>setText:
PluggableTextMorph>>on:text:accept:readSelection:menu:
PluggableTextMorph class>>on:text:accept:readSelection:menu:
FillInTheBlankMorph>>setQuery:initialAnswer:answerHeight:acceptOnCR:
FillInTheBlankMorph class>>request:initialAnswer:centerAt:inWorld:onCancelReturn:acceptOnCR:
FillInTheBlankMorph class>>request:initialAnswer:centerAt:inWorld:onCancelReturn:

Edit: Oh, and then I found where it said "asText" and got rid of it. It gave me this emergency error and Scratch crashed. Didn't have time to copy-paste.

Last edited by randalpik (2010-04-30 11:25:41)


My stuff: http://scratch.mit.edu/users/randalpik
Your face: Look at a gopher

Offline

 

#147 2010-04-30 12:19:34

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

Re: Cool custom blocks in Scratch

waveOSBeta wrote:

What's changed in the Paint Editor Screenshot?

nothing yet.

Offline

 

#148 2010-04-30 12:22:19

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

Re: Cool custom blocks in Scratch

randalpik wrote:

Ok... so I got rid of the scripts that you said to, and then I alt-clicked the button to duplicate. I alt-clicked on the new button, clicked "change arguments", typed in "dialogs" (that's what I wanted) but the text didn't change. I tried to do that by alt-clicking again and clicking "change label". It gave me an error.

the dialog bit is fine, that's what you need to do. to change the label you need to first drag it around, then shift-click the label and type in what you want. then make sure you embed it into the scratchViewerMorph

Offline

 

#149 2010-04-30 17:19:05

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

Re: Cool custom blocks in Scratch

Sparkyasa wrote:

You're right that the <when i receive[message\/]> would be impossible, but I think [wait until I receive [message\/]] would be possible.

No ... nothing's impossible given time ... but anyways, that actually is quite possible. Without excess time.

LS97 wrote:

randalpik wrote:

Ok... so I got rid of the scripts that you said to, and then I alt-clicked the button to duplicate. I alt-clicked on the new button, clicked "change arguments", typed in "dialogs" (that's what I wanted) but the text didn't change. I tried to do that by alt-clicking again and clicking "change label". It gave me an error.

the dialog bit is fine, that's what you need to do. to change the label you need to first drag it around, then shift-click the label and type in what you want. then make sure you embed it into the scratchViewerMorph

Ick, why would you do it THAT way... that's so un-permanent. You should edit the initialization or startup methods for ScratchVeiwerMorph or ScratchFrameMorph

Last edited by nXIII (2010-04-30 17:20:36)


nXIII

Offline

 

#150 2010-04-30 17:56:49

Sparkyasa
Scratcher
Registered: 2008-06-27
Posts: 24

Re: Cool custom blocks in Scratch

What's the code for the (ascii for[])?


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

Offline

 

Board footer