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

#26 2010-02-28 02:58:22

Jonathanpb
Scratcher
Registered: 2008-07-25
Posts: 1000+

Re: ITopic: Cool Source code tricks...

nXIII wrote:

Jonathanpb wrote:

billyedward, I have a question: How do you get the blocks you made to work?

Ok, open a system browser, select one of the three scriptable morphs, then select a category to put the function in. Next, delete the text in the bottommost pane and replace it with your method. For example:

openWindow: t1
    | window |
    window _ SystemWindow new.
    window setLabel: t1 asString.
    window openInWorld: World

Press alt + s, and now you can call this method from the blockSpecs

Okay, now I'm on a computer that has Scratch - I tried it, but I couldn't find the section.  sad

Can you please give clearer instructions?  smile

smile   smile   smile


(billyedward, you can help if you want.  smile  )


"Human beings... must have action; and they will make it if they cannot find it.
-Charlotte Brontë

Offline

 

#27 2010-02-28 03:02:53

Jonathanpb
Scratcher
Registered: 2008-07-25
Posts: 1000+

Re: ITopic: Cool Source code tricks...

billyedward wrote:

However, I will make part 2 or three of this guide series explain this.

Why don't you put it all in this topic? Then they're all going to be in a sticky...  wink


"Human beings... must have action; and they will make it if they cannot find it.
-Charlotte Brontë

Offline

 

#28 2010-02-28 10:38:02

The-Whiz
Scratcher
Registered: 2007-07-09
Posts: 1000+

Re: ITopic: Cool Source code tricks...

Hm... This may sound like a random question, ad it is, but what's the ASCII value of the - (dash) key?

Offline

 

#29 2010-02-28 10:45:19

ThePCKid
Scratcher
Registered: 2009-09-16
Posts: 1000+

Re: ITopic: Cool Source code tricks...

The-Whiz wrote:

Hm... This may sound like a random question, ad it is, but what's the ASCII value of the - (dash) key?

It's U+002D on Windows, sry I don't have a Mac  hmm

Offline

 

#30 2010-02-28 12:37:08

billyedward
Scratcher
Registered: 2008-01-03
Posts: 500+

Re: ITopic: Cool Source code tricks...

The-Whiz wrote:

Hm... This may sound like a random question, ad it is, but what's the ASCII value of the - (dash) key?

2D hex, 45 decimal.
See my post on special characters in the forums to find what they all are:
The number followed by a % is the hex value, and the ones enclosed within &#; is the decimal value.


"I'd love to change the world, but they haven't released the source code yet."
Check out the latest version of Streak --> http://billy.scienceontheweb.net/Streak

Offline

 

#31 2010-03-01 19:11:35

GammaGames
Scratcher
Registered: 2009-07-30
Posts: 13

Re: ITopic: Cool Source code tricks...

uh, im confused. is squeek an OS? im using Windows XP. How do u open the Scratch/Streak window?


http://img12.imageshack.us/img12/8242/nuclearmushroom.png Play TPA, the Tower defence game with 3 maps, 2 game modes, and much more!

Offline

 

#32 2010-03-01 23:13:35

billyedward
Scratcher
Registered: 2008-01-03
Posts: 500+

Re: ITopic: Cool Source code tricks...

GammaGames wrote:

uh, im confused. is squeek an OS? im using Windows XP. How do u open the Scratch/Streak window?

Although there is a squeak OS, what we are using is simply a program.
It runs much like one, though, with little windows and dialogs, etc.
In order to open the scratch/streak window, click on the gray, and then select 'open,' and then either 'scratch' or 'streak' depending on which one it is.


"I'd love to change the world, but they haven't released the source code yet."
Check out the latest version of Streak --> http://billy.scienceontheweb.net/Streak

Offline

 

#33 2010-03-02 22:32:50

butterbelly
Scratcher
Registered: 2010-01-04
Posts: 37

Re: ITopic: Cool Source code tricks...

wow how do I remember all of that  yikes   yikes


http://img221.imageshack.us/img221/9251/cherrypiesu600641l.jpg
American pie, the pie that speaks back. [tastes good to]

Offline

 

#34 2010-03-04 13:01:32

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

Re: ITopic: Cool Source code tricks...

How do I define variables in custom functions?


Check out my projects if you have a chance.

Offline

 

#35 2010-03-04 15:20:44

Stickman704
Scratcher
Registered: 2009-01-31
Posts: 1000+

Re: ITopic: Cool Source code tricks...

Confused again  sad

Which squeak do I open up? When I open it up i get some wierd buttons around it and a blue fading into white background.

I try to get into the scratch source code (just to try) but it's differnt from yours.

Help me please  sad


Dun dun dun dun dun dun.... dun dun dun dun dun dun...  tongue

Offline

 

#36 2010-03-05 00:42:25

billyedward
Scratcher
Registered: 2008-01-03
Posts: 500+

Re: ITopic: Cool Source code tricks...

Stickman704 wrote:

Confused again  sad

Which squeak do I open up? When I open it up i get some wierd buttons around it and a blue fading into white background.

I try to get into the scratch source code (just to try) but it's differnt from yours.

Help me please  sad

You're using the official release of squeak.
Scratch uses MIT squeak.
Simply use the scratch source code instead of squeak by itself to see everything as it is in this tutorial.


"I'd love to change the world, but they haven't released the source code yet."
Check out the latest version of Streak --> http://billy.scienceontheweb.net/Streak

Offline

 

#37 2010-03-05 00:51:21

Jonathanpb
Scratcher
Registered: 2008-07-25
Posts: 1000+

Re: ITopic: Cool Source code tricks...

What happened to your guides about making your own blocks work?  hmm


"Human beings... must have action; and they will make it if they cannot find it.
-Charlotte Brontë

Offline

 

#38 2010-03-05 01:31:25

billyedward
Scratcher
Registered: 2008-01-03
Posts: 500+

Re: ITopic: Cool Source code tricks...

Jonathanpb wrote:

What happened to your guides about making your own blocks work?  hmm

They're still up there:
[open Browser with URL []]
(if<>then[]else[]).
More coming soon!


"I'd love to change the world, but they haven't released the source code yet."
Check out the latest version of Streak --> http://billy.scienceontheweb.net/Streak

Offline

 

#39 2010-03-05 02:51:34

Stickman704
Scratcher
Registered: 2009-01-31
Posts: 1000+

Re: ITopic: Cool Source code tricks...

billyedward wrote:

Stickman704 wrote:

Confused again  sad

Which squeak do I open up? When I open it up i get some wierd buttons around it and a blue fading into white background.

I try to get into the scratch source code (just to try) but it's differnt from yours.

Help me please  sad

You're using the official release of squeak.
Scratch uses MIT squeak.
Simply use the scratch source code instead of squeak by itself to see everything as it is in this tutorial.

Still don't get it  sad

I downloaded scratch source code and opened the.image file in scratch. It's still differnt to yours.

Last edited by Stickman704 (2010-03-05 02:52:02)


Dun dun dun dun dun dun.... dun dun dun dun dun dun...  tongue

Offline

 

#40 2010-03-05 08:18:35

ThePCKid
Scratcher
Registered: 2009-09-16
Posts: 1000+

Re: ITopic: Cool Source code tricks...

Okay, you might wanna make a shortcut.
You should make a shortcut that starts MIT's Squeak then loads the .image.

Code:

"C:\Program Files\Scratch\Scratch.exe" "Path of .image file here"

Next, when you open it, it should look like this
http://i45.tinypic.com/302co5x.png

Last edited by ThePCKid (2010-03-05 08:20:04)

Offline

 

#41 2010-03-05 17:44:04

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

Re: ITopic: Cool Source code tricks...

climber59 wrote:

How do I define variables in custom functions?

If you mean temporary variables, like t2, t3, etc. use this syntax:

method: arg1 name: arg2 ...
| temp1 temp2 temp3 ... |
code.
more code.
...
^ returned

temp1, temp2, and temp3 being the temporary variables.


nXIII

Offline

 

#42 2010-03-06 00:59:09

Jonathanpb
Scratcher
Registered: 2008-07-25
Posts: 1000+

Re: ITopic: Cool Source code tricks...

billyedward wrote:

Jonathanpb wrote:

What happened to your guides about making your own blocks work?  hmm

They're still up there:
[open Browser with URL []]
(if<>then[]else[]).
More coming soon!

Oh, you're using projects?

Those guides aren't helping - I want to make my own blocks, whatever blocks I want, and I want those blocks to work. How do I do that?


"Human beings... must have action; and they will make it if they cannot find it.
-Charlotte Brontë

Offline

 

#43 2010-03-06 01:01:29

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

Re: ITopic: Cool Source code tricks...

nXIII wrote:

climber59 wrote:

How do I define variables in custom functions?

If you mean temporary variables, like t2, t3, etc. use this syntax:

method: arg1 name: arg2 ...
| temp1 temp2 temp3 ... |
code.
more code.
...
^ returned

temp1, temp2, and temp3 being the temporary variables.

But how do I give them a value, besides the ones you enter?


Check out my projects if you have a chance.

Offline

 

#44 2010-03-06 16:03:50

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

Re: ITopic: Cool Source code tricks...

climber59 wrote:

nXIII wrote:

climber59 wrote:

How do I define variables in custom functions?

If you mean temporary variables, like t2, t3, etc. use this syntax:

method: arg1 name: arg2 ...
| temp1 temp2 temp3 ... |
code.
more code.
...
^ returned

temp1, temp2, and temp3 being the temporary variables.

But how do I give them a value, besides the ones you enter?

Use the one of the following syntaxes:

variable _ value

Note: the underscore shows up as a left-pointing arrow
OR

variable := value


nXIII

Offline

 

#45 2010-03-06 22:24:05

billyedward
Scratcher
Registered: 2008-01-03
Posts: 500+

Re: ITopic: Cool Source code tricks...

Jonathanpb wrote:

billyedward wrote:

Jonathanpb wrote:

What happened to your guides about making your own blocks work?  hmm

They're still up there:
[open Browser with URL []]
(if<>then[]else[]).
More coming soon!

Oh, you're using projects?

Those guides aren't helping - I want to make my own blocks, whatever blocks I want, and I want those blocks to work. How do I do that?

To teach you this, I really have to teach you how to use the whole squeak programming language. (search Google for 'squeak tutorial')

I will, however, make a tutorial explaining the basics of block making.


"I'd love to change the world, but they haven't released the source code yet."
Check out the latest version of Streak --> http://billy.scienceontheweb.net/Streak

Offline

 

#46 2010-03-07 11:19:10

Scratchguy3
Scratcher
Registered: 2010-02-07
Posts: 29

Re: ITopic: Cool Source code tricks...

How do you force the 'alt,' 'control,' and 'shift' keys into the <key %k pressed> block?


http://ev.carsoncheng.com/dropbox/scratchguy3-forum-sig.png

Offline

 

#47 2010-03-07 11:58:39

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

Re: ITopic: Cool Source code tricks...

Where are, basically the blockSpecs for the cBlockMorph located?


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

Offline

 

#48 2010-03-07 13:39:18

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

Re: ITopic: Cool Source code tricks...

Scratchguy3 wrote:

How do you force the 'alt,' 'control,' and 'shift' keys into the <key %k pressed> block?

You need to modify the method called asciiFor: in ScriptableScratchMorph's category sensing ops. Add the following lines before ^ -1:

'shift' = t1 ifTrue: [^ 16].
    'control' = t1 ifTrue: [^ 17].
    'alt' = t1 ifTrue: [^ 18].

Press Alt + s.
Next, modify the method 'keyNames'. Add the following after 'space':

'shift' 'control' 'alt'

And press Alt + s.
Three more options should appear in the key menu, and should work.


nXIII

Offline

 

#49 2010-03-07 14:36:17

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

Re: ITopic: Cool Source code tricks...

Could you please tell me how to get other keys into the keypressed boolean block, itd really like to be able to use other keys other than the ones we have already.


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

 

#50 2010-03-07 15:21:05

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

Re: ITopic: Cool Source code tricks...

markyparky56 wrote:

Could you please tell me how to get other keys into the keypressed boolean block, itd really like to be able to use other keys other than the ones we have already.

Look up one post! XD


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

Offline

 

Board footer