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

#26 2010-04-18 11:54:06

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

Re: Cool custom blocks in Scratch

Keba wrote:

Hm, so there is now way of combining own blocks (eg a "clone block hack") and BYOB togehter? Both hack into the image files, don`t they? So way cant I edit the BYOB`s image file and put some nice blocks into it?

And why is there no source code release of BYOB yet? That sucks, too.

BYOB-made blocks don't hack into the image, but simply combine the different pre-made blocks saving the new block into the project. you can try making some of your own blocks with that interface Jens added, but it's not perfect.

Last edited by LS97 (2010-04-18 13:01:55)

Offline

 

#27 2010-04-18 12:04:44

Sperry
Scratcher
Registered: 2010-03-09
Posts: 500+

Re: Cool custom blocks in Scratch

LS97 wrote:

Sperry wrote:

Great! I like it! One suggestion for your mousePressed block. I would suggest
^ false
instead of
^ Sensor redButtonPressed

If it even got as far as the last part, it should return false since it doesn't know what your talking about, why test some stuff that is jargon?

I understand what you mean, but i thought of the lazy people who don't want to enter anything and have it like the default block straight away. what use would it be anyway if it returns false each time?

Well, Why test if a button is pressed if the user didn't specify for it to be? Anyway, it would return false if nothing was pressed anyway, and, if you tested for that one earlier, you'd find ir would return false there.


http://img709.imageshack.us/img709/3252/gobanim2.gifhttp://ls.gd/bo

Offline

 

#28 2010-04-18 12:59:18

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

Re: Cool custom blocks in Scratch

Sperry wrote:

Well, Why test if a button is pressed if the user didn't specify for it to be? Anyway, it would return false if nothing was pressed anyway, and, if you tested for that one earlier, you'd find ir would return false there.

well, true. but i prefer it to be like this. you're free to change it if you prefer to make it false. btw, i gave you an internet  smile

Last edited by LS97 (2010-04-18 15:05:59)

Offline

 

#29 2010-04-18 22:07:42

midnightleopard
Scratcher
Registered: 2007-09-13
Posts: 1000+

Re: Cool custom blocks in Scratch

Keba wrote:

Hm, so there is now way of combining own blocks (eg a "clone block hack") and BYOB togehter? Both hack into the image files, don`t they? So way cant I edit the BYOB`s image file and put some nice blocks into it?

And why is there no source code release of BYOB yet? That sucks, too.

if you want to save the BYOB image, shift click the file and save image for end user


http://pwp.wizards.com/5103673563/Scorecards/Landscape.png

Offline

 

#30 2010-04-19 12:00:07

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

Re: Cool custom blocks in Scratch

midnightleopard wrote:

Keba wrote:

Hm, so there is now way of combining own blocks (eg a "clone block hack") and BYOB togehter? Both hack into the image files, don`t they? So way cant I edit the BYOB`s image file and put some nice blocks into it?

And why is there no source code release of BYOB yet? That sucks, too.

if you want to save the BYOB image, shift click the file and save image for end user

Hmm... that didn't quite work for me. could you explain that better?

Offline

 

#31 2010-04-19 12:03:19

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

Re: Cool custom blocks in Scratch

midnightleopard wrote:

Keba wrote:

Hm, so there is now way of combining own blocks (eg a "clone block hack") and BYOB togehter? Both hack into the image files, don`t they? So way cant I edit the BYOB`s image file and put some nice blocks into it?

And why is there no source code release of BYOB yet? That sucks, too.

if you want to save the BYOB image, shift click the file and save image for end user

You can't hack BYOB's image. Period.


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

 

#32 2010-04-19 12:06:46

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

Re: Cool custom blocks in Scratch

markyparky56 wrote:

midnightleopard wrote:

Keba wrote:

Hm, so there is now way of combining own blocks (eg a "clone block hack") and BYOB togehter? Both hack into the image files, don`t they? So way cant I edit the BYOB`s image file and put some nice blocks into it?

And why is there no source code release of BYOB yet? That sucks, too.

if you want to save the BYOB image, shift click the file and save image for end user

You can't hack BYOB's image. Period.

YES YOU CAN!!!!


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

Offline

 

#33 2010-04-19 12:07:47

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

Re: Cool custom blocks in Scratch

Could you make me a <sprite _ touching sprite_> block


You can now reach me on Twitter @johnnydean1_

Offline

 

#34 2010-04-19 12:13:29

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

Re: Cool custom blocks in Scratch

johnnydean1 wrote:

Could you make me a <sprite _ touching sprite_> block

I'll try and see what i can do. Check back in a few mins, i might have it up!
EDIT: i got the block. here's the code:

Code:

sprite: t1 touching: t2 
    | t3 |
    t3 _ t1 bounds intersect: t2 bounds.
    (t3 width > 0 and: [t3 height > 0])
        ifTrue: [^ true].
    ^ false

i'm so proud of myself  smile

Last edited by LS97 (2010-04-22 12:46:23)

Offline

 

#35 2010-04-19 12:15:02

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

Re: Cool custom blocks in Scratch

MathWizz wrote:

markyparky56 wrote:

midnightleopard wrote:

if you want to save the BYOB image, shift click the file and save image for end user

You can't hack BYOB's image. Period.

YES YOU CAN!!!!

Without creating an error.


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

 

#36 2010-04-19 12:16:13

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

Re: Cool custom blocks in Scratch

Can you please add more blocks, LS97?


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

Offline

 

#37 2010-04-19 12:31:09

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

Re: Cool custom blocks in Scratch

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.

Offline

 

#38 2010-04-19 12:43:14

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

Re: Cool custom blocks in Scratch

big_smile  Cool!

Last edited by waveOSBeta (2010-04-19 12:43:26)


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

Offline

 

#39 2010-04-19 12:49:05

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

Re: Cool custom blocks in Scratch

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!

Offline

 

#40 2010-04-19 13:31:15

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

Re: Cool custom blocks in Scratch

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!

Offline

 

#41 2010-04-19 13:47:33

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

Re: Cool custom blocks in Scratch

There's an easier way to make the key pressed block: have it use a do: loop to go through all the keyNames.


nXIII

Offline

 

#42 2010-04-19 13:51:00

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

Re: Cool custom blocks in Scratch

markyparky56 wrote:

MathWizz wrote:

markyparky56 wrote:


You can't hack BYOB's image. Period.

YES YOU CAN!!!!

Without creating an error.

Yup!


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

Offline

 

#43 2010-04-19 14:08:03

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

Re: Cool custom blocks in Scratch

Could you make a block spec for the "key pressed" reporter? I'm bad at making my own specs... i made 3 blocks, all don't work...


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

 

#44 2010-04-19 14:18:02

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

Re: Cool custom blocks in Scratch

meew0 wrote:

Could you make a block spec for the "key pressed" reporter? I'm bad at making my own specs... i made 3 blocks, all don't work...

I can. here it is. you should have learned where to insert it from the previous posts in this thread.
For the block spec now:

Code:

('key pressed' #r #keyPressed)

obviously, the code in the instance part has to be named 'keyPressed'.
there you go, hope it helps (even a bit)!

Offline

 

#45 2010-04-19 14:19:10

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

Re: Cool custom blocks in Scratch

nXIII wrote:

There's an easier way to make the key pressed block: have it use a do: loop to go through all the keyNames.

Yeah, i know (now).

EDIT: i discovered the timesRepeat block which does what the do: loop block does.

Last edited by LS97 (2010-04-21 13:35:34)

Offline

 

#46 2010-04-19 14:44:42

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

Re: Cool custom blocks in Scratch

LS97 wrote:

meew0 wrote:

Could you make a block spec for the "key pressed" reporter? I'm bad at making my own specs... i made 3 blocks, all don't work...

I can. here it is. you should have learned where to insert it from the previous posts in this thread.
For the block spec now:

Code:

('key pressed' #r #keyPressed)

obviously, the code in the instance part has to be named 'keyPressed'.
there you go, hope it helps (even a bit)!

Yeah, it works. Thanks.
I had to move it in the "ScriptableScratchMorph" class - now it works! (The block and the method was previously in ScratchSpriteMorph).

Apropos:

The blocks i made was "share this project online", "get surprise sprite" and "import image from camera".


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

 

#47 2010-04-19 16:06:31

midnightleopard
Scratcher
Registered: 2007-09-13
Posts: 1000+

Re: Cool custom blocks in Scratch

LS97 wrote:

midnightleopard wrote:

Keba wrote:

Hm, so there is now way of combining own blocks (eg a "clone block hack") and BYOB togehter? Both hack into the image files, don`t they? So way cant I edit the BYOB`s image file and put some nice blocks into it?

And why is there no source code release of BYOB yet? That sucks, too.

if you want to save the BYOB image, shift click the file and save image for end user

Hmm... that didn't quite work for me. could you explain that better?

never mind


http://pwp.wizards.com/5103673563/Scorecards/Landscape.png

Offline

 

#48 2010-04-19 17:18:14

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

Re: Cool custom blocks in Scratch

Here's another tip for formatting blocks on the screen:

Have you ever noticed how many blocks are put into groups, such as all the size blocks, both broadcast blocks, both timer blocks? If you haven't, go look now. Did you see how the groups have spaces between them? Well, when making custom blocks (such as the ones shown above) you might want to have your blocks separated from the rest, or put into their own individual group.

As explained in the original post, all block specs are surrounded by parentheses. Here's how the specs were originally, without a space.

(block spec) (block spec)

To put a space between two specs, change that to this:

(block spec) #- (block spec)

I hope that was helpful!


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

Offline

 

#49 2010-04-19 19:26:18

Jakey22
Scratcher
Registered: 2008-12-28
Posts: 72

Re: Cool custom blocks in Scratch

Please do the dialog block next. Thanks!


http://www.imagebookers.com/gallery/d/2561-1/ubuntu-wallpaper.png http://bullylug.org/linux-penguin.jpg
My website       PENGUINS!!!!!!!!!!!!!!!!!!!!! randomness.

Offline

 

#50 2010-04-19 19:34:46

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

Re: Cool custom blocks in Scratch

Jakey22 wrote:

Please do the dialog block next. Thanks!

Why are you asking for blocks with existing tutorials?


nXIII

Offline

 

Board footer