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

#751 2010-06-26 11:20:49

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

Re: Cool custom blocks in Scratch

LS97 wrote:

LS97 wrote:

nXIII wrote:


That's an already-defined special-form, I believe #doWhile, maybe?

hmm... i suppose so.
i'll play around with those forms.

nXIII,
back to page 24 in this thread.

you once told me that the function for the 'When %b is true' block was stored in a special form called doWhile. When i became i little better at squeak, i saw that in fact that's simply for a c block called 'do while %b', which was later replaced by the 'do until %b'.

it's exactly the same thing, but one of them waits until the condition is true, and one until the condition is false. Any other help?

PS. about the special forms for C blocks. How do you take the first argument for the block from the array it's stored into?

@PS: argumentsVariable first.

or (argumentsVaraible at: index)

but make sure to use parentheses on the second one so that the wrapping message stays intact.


nXIII

Offline

 

#752 2010-06-26 11:21:07

pwiter
Scratcher
Registered: 2010-06-02
Posts: 100+

Re: Cool custom blocks in Scratch

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!

In which ops do I put the code!!


http://i.imgur.com/YBeXc.png

Offline

 

#753 2010-06-26 15:21:01

climber59
Scratcher
Registered: 2009-12-15
Posts: 100+

Re: Cool custom blocks in Scratch

Whichever one you want.


Check out my projects if you have a chance.

Offline

 

#754 2010-06-26 23:40:10

paserra
Scratcher
Registered: 2010-06-06
Posts: 10

Re: Cool custom blocks in Scratch

I didn't find this before: try it.

('setFullScreen %b' #- #setFullScreen:)

setFullScreen: t1
    Smalltalk fullScreenMode: t1

Regards,
Pier Andrea.

Offline

 

#755 2010-06-27 07:28:46

henley
Scratcher
Registered: 2008-06-21
Posts: 1000+

Re: Cool custom blocks in Scratch

pwiter 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!

In which ops do I put the code!!

In which ops you put the code doesn't matter. It was just created for organization.


"I've worked so hard for you and you give me nothing in return. Do you need help... Or do I?"

Offline

 

#756 2010-06-27 10:17:03

pwiter
Scratcher
Registered: 2010-06-02
Posts: 100+

Re: Cool custom blocks in Scratch

henley wrote:

pwiter 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!

In which ops do I put the code!!

In which ops you put the code doesn't matter. It was just created for organization.

OK I tried that and it said, unknown variable: t1


http://i.imgur.com/YBeXc.png

Offline

 

#757 2010-06-27 12:34:28

henley
Scratcher
Registered: 2008-06-21
Posts: 1000+

Re: Cool custom blocks in Scratch

pwiter wrote:

henley wrote:

pwiter wrote:

In which ops do I put the code!!

In which ops you put the code doesn't matter. It was just created for organization.

OK I tried that and it said, unknown variable: t1

Okay, if you REALLY REALLY REALLY REALLY want to know.  I will give you the WHOLE tutorial!

Step 1: Open the system browser

Step 2: Go to the block specs

Step 3: Enter the block spec:

if in the nonsource version:

Code:

('link to %s' #- #linkTo: 'http://scratch.mit.edu/')

if in the source version:

Code:

('link to %s'     -     linkTo: 'http://scratch.mit.edu/')

Step 4: Enter the code for the block in 'other ops'.

Step 5: The code being:

Code:

linkTo: t1

    Cursor wait showWhile: [ScratchPlugin primOpenURL: t1]

Is there anything else?


"I've worked so hard for you and you give me nothing in return. Do you need help... Or do I?"

Offline

 

#758 2010-06-27 15:10:17

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

Re: Cool custom blocks in Scratch

nXIII wrote:

LS97 wrote:

LS97 wrote:


hmm... i suppose so.
i'll play around with those forms.

nXIII,
back to page 24 in this thread.

you once told me that the function for the 'When %b is true' block was stored in a special form called doWhile. When i became i little better at squeak, i saw that in fact that's simply for a c block called 'do while %b', which was later replaced by the 'do until %b'.

it's exactly the same thing, but one of them waits until the condition is true, and one until the condition is false. Any other help?

PS. about the special forms for C blocks. How do you take the first argument for the block from the array it's stored into?

@PS: argumentsVariable first.

or (argumentsVaraible at: index)

but make sure to use parentheses on the second one so that the wrapping message stays intact.

ok thanks a lot!
anyone else can answer the other q, maybe?

Offline

 

#759 2010-06-27 15:40:28

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

Re: Cool custom blocks in Scratch

ok. in case the other question isn't so clear, i would like to know how to make the when hat block work.

Offline

 

#760 2010-06-27 15:49:48

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

Re: Cool custom blocks in Scratch

LS97 wrote:

ok. in case the other question isn't so clear, i would like to know how to make the when hat block work.

Oh, I think the When Hat is ('When %b is true' #W #-) I'm not sure about the middle symbol, though.


nXIII

Offline

 

#761 2010-06-27 16:24:55

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

Re: Cool custom blocks in Scratch

@nXIII,
yes it is but it apparently doesnt work with the source code (didnt try Scratch code)

Offline

 

#762 2010-06-28 03:26:50

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

Re: Cool custom blocks in Scratch

btw everyone,
I am currently adding color support to bingo! it doesnt have square edges like panther, but it can fit in color arguments like the
[blocks]<touching color[ ]>[/blocks],
and the watcher turns that color if you make it. if you click on the color block the text in the tooltip is that color. it works for pen color too.

oh and i didnt even look at panther's code. so proud of myself  smile

Last edited by LS97 (2010-06-28 03:28:01)

Offline

 

#763 2010-06-28 11:15:00

azaquaz
Scratcher
Registered: 2010-01-09
Posts: 54

Re: Cool custom blocks in Scratch

What do you mean by "click on to class" in the first post?

Offline

 

#764 2010-06-28 11:32:01

dav09
Scratcher
Registered: 2009-03-25
Posts: 1000+

Re: Cool custom blocks in Scratch

hey does anyone know how to have insert a toggle button?

Offline

 

#765 2010-06-28 12:04:32

comp500
Scratcher
Registered: 2010-01-08
Posts: 1000+

Re: Cool custom blocks in Scratch

Hi guys! I'm back!


800 posts! W00T! Oh sorry im not on a lot but at least i have 1000+ posts

Offline

 

#766 2010-06-28 12:37:56

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

Re: Cool custom blocks in Scratch

azaquaz wrote:

What do you mean by "click on to class" in the first post?

click on the button that says class

Offline

 

#767 2010-06-28 12:55:15

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

Re: Cool custom blocks in Scratch

dav09 wrote:

hey does anyone know how to have insert a toggle button?

yes i do. here it is:

| tog |
tog _ ToggleButton new.
tog position: 100@100.
tog extent: 100@25.
tog label: 'some label'.
tog actionSelector: #fillScreenOff.
self addMorph: tog.

obviously this code would have to be inserted somewhere inside ScratchFrameMorph for the toggle button to appear correctly and to work. but you can place it in the morph you want, as long as it can have submorphs and the actionSelector symbol (or command, i.e. #fillScreenOff) is present in that morph or owner (if that morph is a submorph). you can choose whatever extent and position you prefer, and change the label.

hope it helps!

EDIT: if you want to run an action which is in another morph, simply add the code
tog target: (WhateverMorph)
before the addMorph code.

Last edited by LS97 (2010-06-28 13:52:55)

Offline

 

#768 2010-06-28 12:56:17

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

Re: Cool custom blocks in Scratch

comp500 wrote:

Hi guys! I'm back!

hi  smile

Offline

 

#769 2010-06-28 15:19:14

dav09
Scratcher
Registered: 2009-03-25
Posts: 1000+

Re: Cool custom blocks in Scratch

thanks thats great!
Im still stuck a little though, when i put tog in it changes to t1
Sorry im new to programming
And am in putting it in the right place, on the block i want it(in scratch blocks and in scriptablescratch morph is and the block in sensing i wast it on). thanks  smile

it also comes up "nothing more expected"
ill post an image...

Last edited by dav09 (2010-06-28 15:37:47)

Offline

 

#770 2010-06-28 15:34:30

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

Re: Cool custom blocks in Scratch

oh, that's normal since you're using the non-source code. don't worry. just use t1 instead of tog in every place of the code. but, just curious, what do you need it for?

Offline

 

#771 2010-06-28 15:42:20

dav09
Scratcher
Registered: 2009-03-25
Posts: 1000+

Re: Cool custom blocks in Scratch

ok thanks, its because im importing the net scratch blocks to 1.4
this was the image anyway, i know now, thanks  smile
I also realise it needs to be a reporter... not a command!
#g was removed in 1.4
http://dav2.webs.com/scr1.4n.jpg

Last edited by dav09 (2010-06-28 16:11:29)

Offline

 

#772 2010-06-28 16:27:48

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

Re: Cool custom blocks in Scratch

@dav09,

i still dont get what you need the tog button for. and you could have just looked at the netScratch blocks and copied them exactly to 1.4.

please explain better, this is interesting but confusing  hmm

Offline

 

#773 2010-06-28 16:35:23

dav09
Scratcher
Registered: 2009-03-25
Posts: 1000+

Re: Cool custom blocks in Scratch

well i thought i would be cool if netscratch was in 1.4 and i need the tog button next to
http://dav2.webs.com/sc11.jpg
bigger pic http://dav2.webs.com/sc11.jpg
i also realised that the type of block which was #g does not exist in 1.4 so i had to edit this andchange it to #r(in block specs)

net scratch was an old experimental version of scratch... never released... (was leaked i think)

Last edited by dav09 (2010-06-28 16:43:28)

Offline

 

#774 2010-06-29 02:56:05

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

Re: Cool custom blocks in Scratch

i know about netScratch, but if you needed a checkbox you could have asked for that, it's a specific kind of toggle button. different morph. but wat's the toggle button for anyway?

Offline

 

#775 2010-06-29 03:00:07

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

Re: Cool custom blocks in Scratch

oh ok i get it. had a look at netScratch (had it downloaded already) and saw that what you need is NOT a toggle button in the block, but a watcher in front of the block.

that's editable in CommandBlockMorph's canBecomeWatcher, without the need to add the morph directly.

Offline

 

Board footer